|
database
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Backup using TSQL QuestionWhen I issue the command to 'BACKUP' my Database it does so with no problem. However it appends to the last backup. How do I make it overwrite it. I am using the following code if not exists (select * from master.dbo.sysdevices where name = 'SACS2' ) begin USE master EXEC sp_addumpdevice 'disk', 'SACS2', 'c:\Program Files\Microsoft SQL Server\MSSQL\BACKUP\SACS2.dat' end BACKUP DATABASE SACS TO SACS2 Mark Moss Mark Moss wrote:
Show quote > Ladies / Gentlemen Include WITH INIT in the backup command, or write to a different file... > > > When I issue the command to 'BACKUP' my Database it does so > with no problem. > > However it appends to the last backup. How do I make it > overwrite it. > > > I am using the following code > > if not exists (select * > from master.dbo.sysdevices > where name = 'SACS2' ) > begin > USE master > EXEC sp_addumpdevice 'disk', 'SACS2', 'c:\Program Files\Microsoft SQL > Server\MSSQL\BACKUP\SACS2.dat' > end > > BACKUP DATABASE SACS TO SACS2 > > > > Mark Moss > > Found this in Books Online, under the BACKUP command... Try:
BACKUP DATABASE SACS TO SACS2 WITH INIT -- Show quoteArnie Rowland, YACE* "To be successful, your heart must accompany your knowledge." *Yet Another Certification Exam "Mark Moss" <markm***@adelphia.net> wrote in message news:efN9mkGnGHA.4620@TK2MSFTNGP05.phx.gbl... > Ladies / Gentlemen > > > When I issue the command to 'BACKUP' my Database it does so > with no problem. > > However it appends to the last backup. How do I make it > overwrite it. > > > I am using the following code > > if not exists (select * > from master.dbo.sysdevices > where name = 'SACS2' ) > begin > USE master > EXEC sp_addumpdevice 'disk', 'SACS2', 'c:\Program Files\Microsoft > SQL > Server\MSSQL\BACKUP\SACS2.dat' > end > > BACKUP DATABASE SACS TO SACS2 > > > > Mark Moss > >
Other interesting topics
|
|||||||||||||||||||||||