Skip to content

Month: June 2015

Restoring a DB to a different directory

RESTORE DATABASE [MyDatabase]
FROM DISK = N'E:\MyDatabase.bak'
WITH FILE = 1,
MOVE N'MyDatabase'
TO N'C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\Data\MyDatabase.mdf',
MOVE N'MyDatabase_Log'
TO N'C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\Data\MyDatabase.ldf',
NOUNLOAD, REPLACE, STATS = 10
GO

http://www.codeproject.com/Articles/708720/Solution-The-WITH-MOVE-clause-can-be-used-to-reloc

 

Leave a Comment