Search code examples
sql-server-2005sql-server-2005-express

Error opening .mdf file through SQL Server Management Studio Express


I am doing a project of a web enabled database. I have created the database file in my PC.

Now when I just want to open .mdf i.e. of the database I created, I cannot open it in other PC. I even had copied the .ldf file i.e the log file to that PC.

Since I need to transfer the database to the Server later, I don't know how I will dump the database in that server from my PC so that the company can use it.


Solution

  • The basics of using mdf file is like this:

    1. Create a new database using SQL Server (set the path for the file as you wish)
    2. If you wish to move the file elsewhere,
      • detach the database from your server
      • copy/move the file to wherever you wish
      • attach the file as database in SQL server

    You are not supposed to open the file by double-clicking as mime setting or attachment of extensions migh not be there in the target machine.

    Why don't you use the decent method to copy/move database?