posted on Monday, September 27, 2004 8:24 AM by beedeep

Magic Script for restoring a SQL Database

This is a small magic script to quickly restore a SQL Server database

<Script>

RESTORE DATABASE  MyDatabase // Where MyDatabase is the database name you want to create

FROM DISK = 'C:\MyDatabase.BAK'  // the physical path of the '.bak file'

WITH MOVE 'MyDatabase_Data' TO 'C:\Program Files\Microsoft SQL Server\MSSQL\Data\MyDatabase.mdf',   \\ this needs to be the installation path of the SQL Server

MOVE MyDatabase_Log' TO C:\Program Files\Microsoft SQL Server\MSSQL\Data\MyDatabase.ldf'      \\ this needs to be the installation path of the SQL Server

GO

</Script>

 Enjoy !!

Comments