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.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 backup & restore

Author  Topic 

kid_on_the_block
Posting Yak Master

172 Posts

Posted - 2006-06-02 : 05:58:48
Hi

I have 2 databases namely A & B respectively..... I have written a stored procedure that takes the backup of database A ....... Both the databases are operational .... Can I restore this Backup of Database A ...to Database B .... Is it possible. ....

I have read soimething that we can do it but with the Restore command we have to use the with move option...

I dont seem to understand this can someone please help me on this one....


Thanks .......

Kid.

nr
SQLTeam MVY

12543 Posts

Posted - 2006-06-02 : 06:13:33
The backup will default to restore the origional database files. If you are restoring to the same server (or a server with a different folder structure) then this won't work.
The move option allows you to specify where these files are created. You just specify the logical file name and location.
You can get the info from the backup by restoring the header.
This sp gets the filenames and changes the location for a restore.

http://www.nigelrivett.net/SQLAdmin/s_RestoreDatabase.html

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page
   

- Advertisement -