Phuket IT

Computer => Computer Problem => Topic started by: admin on 27, 08, 2013, 10:49:01

Title: Restore database with change path
Post by: admin on 27, 08, 2013, 10:49:01
(http://www.mytechmantra.com/LearnSQLServer/SQLArticleImages/HowToRestoreDatabase/Restore-Database-TSQL-Script.png)

New query from database name: master

Code: [Select]
RESTORE DATABASE <database_name>
FROM DISK = 'd:\MSSQL\BACKUP\<backup_name>.bak'
WITH MOVE '<database_name>' TO 'd:\MSSQL\DATA\<database_name>.mdf',
MOVE '<database_name>_Log' TO 'd:\MSSQL\DATA\<database_name>_Log.ldf',
REPLACE,
STATS=10
GO

ref: http://stackoverflow.com/questions/7994788/restore-database-and-change-the-location-for-mdf-file