Comments
3 comments
-
It will not overwrite an existing file. To overwrite an existing file, use the INIT keyword e.g.
EXEC master..sqlbackup '-sql "BACKUP DATABASE pubs TO DISK = [<AUTO>] WITH INIT"' -
this is the way my code looks:
exec master..sqlbackup '-SQL "BACKUP DATABASE DW_Data_Mart TO DISK = [D:\SQL_Backups\DW_Data_Mart.SQB] " '
As you can see I am qualifying the file name that the backup is getting saved to. By using the above code is it going to replace/overwrite the file each and every time? -
No, you need to append the INIT option i.e.
EXEC master..sqlbackup '-SQL "BACKUP DATABASE DW_Data_Mart TO DISK = [D:\SQL_Backups\DW_Data_Mart.SQB] WITH INIT" '
Add comment
Please sign in to leave a comment.
:?: