'I need the backup name to include today's date when using MSSQL RDS backups
I am creating a stored procedure that is making backups straight from RDS MSSQL to S3. I need the backup name that gets placed in S3 to include today's date, thus, I need to include a Parameter (@NOW) in the name.
ALTER PROC [dbo].[USP_DatabaseFullBackup]
AS
DECLARE @NOW DATETIME,
@SERVERNAME VARCHAR(100)
SET @NOW = (SELECT GETDATE())
SET @SERVERNAME = (@@SERVERNAME)
BEGIN
exec msdb.dbo.rds_backup_database
@source_db_name='MyDB',
@overwrite_S3_backup_file=0,
@s3_arn_to_backup_to='arn:aws:s3:::MyBucket/Backups/FULL/MyDB'+@NOW+''
END'
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|