I\'m using the below to backup a db from a SQL job. Can someone tell me how to add the current date to the output filename? Preferably in YYYYMMDD format.
BACK
DECLARE @MyFileName varchar(1000) SELECT @MyFileName = (SELECT '\\ServerToSave\Path\MyDB_' + convert(varchar(500),GetDate(),112) + '.bak') BACKUP DATABASE [myDB] TO DISK=@MyFileName ...