Here is a way to restore database backup using SQL script.

The first step is to get the logical file names contained in the backup device.

1_restore database backup using sql script

If database is being restored on an existing database, the second step is to disconnect all sessions to that database.

The third step is to construct the restore database command based on the logical file name returned from the first step. If the database is being restored to new location then specify the new path for the database files using the MOVE command. The query for the same is shown below.

In order to overwrite existing database append REPLACE command to above query.

The last step is to bring database to multi_user mode if it doesn’t come up by itself.


Like us on FaceBook Join the fastest growing SQL Server group on FaceBook

Follow me on TwitterFollow me on FaceBook