Backups to overwrite, not append

I have SQL Server 2000 running on a Win2K Server platform.

I use the SQL Server Agent > Jobs to schedule daily backups of my databases.
The backups are done to a hard drive on the network.
I have 7 backups, one for each day of the week, so that I can keep the last whole weeks data. Each days backup is done to a different file.

This is the T-SQL I use to run Mondays backup:

backup database myDB
to myDB_mon_backup
with
retaindays = 6


The problem I am having is that when the next Mondays backup runs it APPENDS the backup to the old file, so my backup file gets bigger and bigger every week.

Can you show me the T-SQL that will OVERWRITE the old backup?

Thanks.
naqayyaAsked:
Who is Participating?
 
arbertConnect With a Mentor Commented:
add WITH INIT to your backup statement
0
 
naqayyaAuthor Commented:
Is this the correct syntax:

backup database myDB
to myDB_mon_backup
with
retaindays = 6,
INIT
0
 
FatalErrCommented:
If you right click on your database and choose "All Tasks", "Maintenance Plan" a wizard will help you set up a plan that will automatically give individual names to the backup files based on the database name and the date of backup.   They are not appended (I think that is the only way it works, i.e. append isn't an option). It's really easy to do and the best way I have found to set up my backups.
0
 
naqayyaAuthor Commented:
Thanks for your help FatalErr. I would rather stick to the backups that I have already setup for the time being, so arbert's solution is good for me.

Thanks again.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.