I am trying to attach .mdf and .ldf file of an existing database with some change and different name.When i am attaching them , sql server automatically converting them to their original names(existing data base name) and giving out an error .
Adding .mdf and .ldf of an existing database by renaming them in SQL server 2005
sql-server-2005
Best Answer
As far as my understanding goes that's kind of the way it is with detach and attach - this is both good and bad - good because database is substantially self contained within those files as it contains its own metadata notionally making moving a database easy, bad because there are scenarios where this isn't what one wants.
There are two obvious ways to deal with this depending on exactly what you are able to do: