Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
sirwan
Starting Member
4 Posts |
Posted - 2013-05-04 : 19:02:01
|
Hi allHow can i restore a data base to a specific directory like d:\db_name.mdf .And i need to do this by code????? |
|
russell
Pyro-ma-ni-yak
5072 Posts |
Posted - 2013-05-06 : 11:53:53
|
Use the WITH MOVE clause in your restore statement. |
|
|
jackv
Master Smack Fu Yak Hacker
2179 Posts |
Posted - 2013-05-07 : 01:47:57
|
use the RESTORE FILELISTONLY FROM DISK = 'H:\test1.bak' to identify the files currently in the backup fileThen construct a sql statement using something like:RESTORE DATABASE TestFROM DISK = 'F:\mybackup.bak'WITH MOVE 'TestData' TO 'D:\test.MDF',MOVE 'TestLog' TO 'E:\test.LDF'Jack Vamvas--------------------http://www.sqlserver-dba.com |
|
|
sirwan
Starting Member
4 Posts |
Posted - 2013-05-15 : 12:24:48
|
it work's Thank's :) |
|
|
jackv
Master Smack Fu Yak Hacker
2179 Posts |
Posted - 2013-05-16 : 01:43:22
|
your welcomeJack Vamvas--------------------http://www.sqlserver-dba.com |
|
|
|
|
|