Subscribe to RSS Feed
Twitter
HIRE ME! home  archives  about  blogroll

Restore DB with T-SQL.

04 Oct 2005

Just found this useful command over here. You can restore a db backup via the command:

RESTORE DATABASE MyDB FROM DISK = 'C:\Data\MyDB.bak' WITH MOVE 'logicalname_data' TO 'C:\Data\MyDB.mdf', MOVE 'logicalname_Log' TO 'C:\Data\MyDB.LDF'

To find out what the logicalname is one can execute the following:

RESTORE FILELISTONLY FROM DISK = 'C:\Data\MyDB.bak'

blog comments powered by Disqus