How to attach mdf files from a different SQL Server Install?

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:

  • Enter a new name for a (nonexisting) database in the Attach As field in the top frame
  • In the bottom frame, browse to both the new mdf file and the new ldf file you just created.

You should then get the new database attached.