Bookmark and Share
Restore a SQL server DB by using command lines
(Publish Date: 2014-5-21 5:12pm, Total Visits: 445, Today: 1, This Week: 1, This Month: 7)

USE master;
GO

IF EXIST (SELECT 1 FROM sys.databases WHERE name = 'N'Market')
    DROP DATABASE Market;
GO

RESTORE DATABASE Market
FROM DISK = 'D:\...\Market.mdf',
WITH MOVE 'MarketDev' TO 'D:\MKTG\Market.mdf',
     MOVE 'MarketDev_log' TO 'L:\MKTG\Market.ldf';
GO

ALTER AUTHORIZATION ON DATABASE::Market TO [Domain\Administrator]'
GO