MSSQL 2008 Backup Script Help
Posted on 2011-04-27
We are currently running a nightly backup at 11:30pm with this script. (MSSQL 2008 on Windows 2008 Server)
declare @Path varchar(500) , @DBName varchar(128)
select @DBName = 'MyDataBase'
select @Path = 'B:\SQLBackup\MyDataBase\'
declare @FileName varchar(4000)
select @FileName = @Path + @DBName + '_Full_'
+ convert(varchar(8),getdate(),112) + '_'
backup database @DBName to disk = @FileName
It works fine except we continually have to go in and delete the old backups. We just want to keep a months worth of backups. Is there a script that we could add that would delete anything older then a month?