Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
parallon
Starting Member
25 Posts |
Posted - 2006-10-30 : 15:54:48
|
Hello all. I was just wondering how I could add the current date and time to the name of the .bak file. I perform a full backup daily and would like to keep a weeks worth of backups, but everytime I run the job, it just overites the previous one.The command in the wizzard is:BACKUP DATABASE [snl] TO DISK = N'C:\Backups_for_FTP\SNL_Full.bak' WITH NOINIT , NOUNLOAD , NAME = N'snl backup', SKIP , STATS = 10, DESCRIPTION = N'SNL Backup', NOFORMAT Thanks,Parallon |
|
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2006-10-30 : 15:58:13
|
| DECLARE @filename nvarchar(128)SET @filename=N'C:\Backups_for_FTP\SNL_Full' + convert(varchar(8), getdate(), 112) + '_' + replace(convert(varchar(8), getdate(), 108), ':', '') + '.bak' BACKUP DATABASE [snl] TO DISK = @filename WITH NOINIT , NOUNLOAD , NAME = N'snl backup', SKIP , STATS = 10, DESCRIPTION = N'SNL Backup', NOFORMAT |
 |
|
|
parallon
Starting Member
25 Posts |
Posted - 2006-10-30 : 17:22:55
|
| Thank you so much. That worked perfectly...Parallon |
 |
|
|
|
|
|
|
|