Options

Backup extended stored procedure

dwjongbloeddwjongbloed Posts: 30
edited November 27, 2007 8:34AM in SQL Backup Previous Versions
when using this stored procedure does it automatically assume replace the existing file or is there a parmater that I need to qualify?

:?:

Comments

  • Options
    peteypetey Posts: 2,358 New member
    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"'
    Peter Yeoh
    SQL Backup Consultant Developer
    Associate, Yohz Software
    Beyond compression - SQL Backup goodies under the hood, updated for version 8
  • Options
    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?
  • Options
    peteypetey Posts: 2,358 New member
    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" '
    Peter Yeoh
    SQL Backup Consultant Developer
    Associate, Yohz Software
    Beyond compression - SQL Backup goodies under the hood, updated for version 8
Sign In or Register to comment.