I want to create a scheduled task that will run (every night) a SQL script to fully backup my database X to a file. I want that file to store up to 7 full backups. The way I tried doing this is using the following code:
SELECT @SQL = '
BACKUP DATABASE [X]
TO DISK = N''\file.bak''
WITH NOFORMAT, NOINIT, NAME = N''name'', RETAINDAYS = 7
'
But this doesn't overwrite/delete full backups contained on that file that are older than seven days.
Any ideas? Suggestions for alternatives?
Thanks