How can we help you today? How can we help you today?

Backup extended stored procedure

when using this stored procedure does it automatically assume replace the existing file or is there a parmater that I need to qualify?

:?:
dwjongbloed
0

Comments

3 comments

  • petey
    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"'
    petey
    0
  • dwjongbloed
    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?
    dwjongbloed
    0
  • petey
    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" '
    petey
    0

Add comment

Please sign in to leave a comment.