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 |
jay1
Starting Member
17 Posts |
Posted - 2010-09-07 : 07:11:55
|
I'm using the following script to perform a full daily backup but I need the previous day Backup to be overwritten but it's not working. What would I need to do to make this happen please? declare @CheckDate [nvarchar](50), @Title [nvarchar](100)set @CheckDate = replace(replace(convert(nvarchar(50),getdate(),120),':',''), ' ', '_')set @Title = N'E:\'Datbasename'_Full_'+@CheckDate+''+'.bak' BACKUP DATABASE 'Datbasename'TO DISK = @TitleWITH NOFORMAT,INIT, NAME = N''Datbasename'-Full Database Backup', SKIP, NOREWIND, NOUNLOAD,STATS = 10;Thank you |
|
russell
Pyro-ma-ni-yak
5072 Posts |
Posted - 2010-09-07 : 08:27:18
|
you're going to have to write another script to delete old backup files.it's not overwriting because you're giving it a different name every day (as you should be) |
|
|
jay1
Starting Member
17 Posts |
Posted - 2010-09-07 : 09:17:45
|
quote: Originally posted by russell you're going to have to write another script to delete old backup files.it's not overwriting because you're giving it a different name every day (as you should be)
I thought the INIT key word is used to overwrite previous backups? |
|
|
russell
Pyro-ma-ni-yak
5072 Posts |
Posted - 2010-09-07 : 09:49:16
|
it's used to overwrite previous backup sets with the same namein other words if i name my backup database.bak, then back it up again with init to database.bak, it will overwrite.but if i name it database_20100906.bak, and tomorrow i name it database_20100907.bak, they aren;t the same and with init will not overwrite database_20100906 |
|
|
|
|
|
|
|