Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ODBC SQLstate 42000 cannot associate files with different databases

Status
Not open for further replies.

hblabonte

Programmer
Oct 3, 2001
84
US
I receive the following message while trying to restore a database in our test system. I'm using a backup from our live server, restoring it to our test server. What am I missing?

cannot associate files with different databases ODBC SQLstate 42000
 
Interesting! OK ... are we using a TRUE backup file or did you copy the MDF and LDF database files from the live server over to the test server?

Thanks

J. Kusch
 
True backup... On live, I did a "backup database". When complete, I copied that file to the backup directory on the test server. Then I performed a "restore database" from device, navigate to that backup file.
 
OK couple of questions:

1. Does the database ALREADY exist on the test server?

2. If so, does the directory structure where the MDF/LDF match where the MDF/LDF reside on the live server. In this I mean if the files on the live server were located in the C:\MyDir\Data folder, do they also reside like that on the test server?

IF NOT ... you need to use the WITH MOVE option to place the MDF and LDF in the folder(s) that are being used on your test server. If you are using the Restore wizard, you need to change the file path on the Options tab of the wizard. Change the path in the "Move to physical file name" option to the desired location.

Thanks

J. Kusch
 
A quick Google search on that came up with several pages referring to people trying to restore different DB types to SQL Server. Which leads me to ask, are you using 2 different versions of SQL Server (like 7 and 2000) between your machines?



Catadmin - MCDBA, MCSA
"If a person is Microsoft Certified, does that mean that Microsoft pays the bills for the funny white jackets that tie in the back???
 
Ok, got it to work! The location for the log file was different. Thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top