Restore a database using a batch file

  • Hi Guys

    Is there a simple way to restore a database to a previous state(i.e. from a .bak file) from a batch file?

    Basically I want to be able to use a DB for demo purposes, fill it full of meaningless data, then afterwards just run a batch file to overwrite it with an empty backup... rather than doing a restore through SQL server..

    Any help would be much appreciated.

    Cheers

    John

  • Do a google search on SQLCMD

    __________________________
    Allzu viel ist ungesund...

  • or powershell invoke-sqlcmd.

    Both of these can be scheduled. Its also possible to make the file name dynamic and/or loop through multiple files in a folder.

    It depends on how flexible you want the process to be.

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply