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
 SQL Server 2000 Forums
 SQL Server Development (2000)
 SQL Restore to new database

Author  Topic 

tfrugia
Starting Member

1 Post

Posted - 2006-03-18 : 15:24:29
Hello all,

I am using SQLDMO to try and restore a database to a 'new' database. I am using the relocatefiles property and setting it correctly, but when I restore I always get the error:

"[Microsoft][ODBC SQL Server Driver][SQL Server]Logical file 'OLDDATABASENAME' is not part of database 'NEWDATABASENAME'. Use RESTORE FILELISTONLY to list the logical file names.
[Microsoft][ODBC SQL Server Driver][SQL Server]RESTORE DATABASE is terminating abnormally."

My code is set up like this:

restoreObject.RelocateFiles = "[oldDbName],[C:\newDbName.mdf],[oldDbName],[C:\newDbName.ldf]";

Any ideas?

jen
Master Smack Fu Yak Hacker

4110 Posts

Posted - 2006-03-18 : 23:24:27
use the with move option

review the restore database syntax in BOL

hth

--------------------
keeping it simple...
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2006-03-19 : 02:20:31
"review the restore database syntax in BOL"

Or here!

http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=55210&SearchTerms=RESTORE%20syntax%20/%20example,Restore

Kristen
Go to Top of Page
   

- Advertisement -