Hi I have mdf and ldf files from a different SQL Server install from a machine i dont have access to now, and would like attach them to my current install to get at the data. When I try this, I get an error:
Cannot attach a database with the same name as an existing database. (Microsoft.SqlServer.Smo)
This is because the mdf is named msdbdata, just like my current install. I don't know if there is even a way to rename this database now or what I can do. Any help would be appreciated. Thanks!
Best Answer
You can rename the file, or put it in a different folder than your existing file, and then make sure to change the name of the database when you reattach it.
How are you trying to reattach it? Via SQL Server Management Studio or through tsql?
First, copy your mdf and ldf files to something new (name them relative to a new database you'll attach them as). Then in the Attach Databases screen:
You should then get the new database attached.