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.

 All Forums
 SQL Server 2005 Forums
 Express Edition and Compact Edition (2005)
 SQL Backup script

Author  Topic 

stooartbaby
Starting Member

1 Post

Posted - 2009-10-26 : 21:03:27
Hi Guys,

I am trying to create a nightly backup script for a DB, this one below works fine except that it appends the data each night... i just need it to overwrite. I think it has something to do with the NOINIT ?? is that correct?? i would really apprieciate some help...

Thanks,
Stuart.

++++++++++++++++++++++
BACKUP DATABASE [appname_local] TO DISK = N'D:\appname\appname_Backup\appname_DB_Nightly', DISK = N'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Backup\appname_local.bak' WITH NOFORMAT, NOINIT, NAME = N'appname_local-Full Database Backup', SKIP, NOREWIND, NOUNLOAD, STATS = 10
GO
++++++++++++++++++++++

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2009-10-26 : 23:37:28
You need to use WITH INIT in order to overwrite. NOINIT means to append and is the default.

Here's my custom script in case you are interested: http://weblogs.sqlteam.com/tarad/archive/2009/09/08/Backup-SQL-Server-2005-and-2008-Databases.aspx

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog

"Let's begin with the premise that everything you've done up until this point is wrong."
Go to Top of Page
   

- Advertisement -