open a .mdf database file


  • Is it possible to open a .mdf database file created in Visual Studio with some external SQL server IDE like Quest Toad for SQL server? Databases created in Visual Studio are rather similar to simple Access databases in that they're a single file.

    It appears external IDE's like Toad can't see the .mdf being served by my localhost's SQL server instance under MYMACHINE\SQLEXPRESS - I assume because these files are only served within Visual Studio with the .Net framework provider for SQL server, so my local sql server instance doesn't serve these files. Is that the case? Is there some way to access these databases locally outside of Visual Studio?
    Tuesday, February 05, 2013 7:21 AM


All replies

  • Hello,

    You can't open a SQL Server database file MDF with a tool like toad or SSMS; you have to attach it to a running SQL Server, only then you can access it and read/write data.

    Olaf Helper

    Blog Xing

    Tuesday, February 05, 2013 7:28 AM
  • Regarding " Is there some way to access these databases locally outside of Visual Studio?", the SQL Server Database Engine running as a Windows service will connect to the files. You can connect to the SQL Server Database Engine using any client, such as Microsoft Access, or Excel, or ODBC. Start by using the SQL Server management client that ships with SQL Server, called SQL Server Management Studio. A free version is available at One of those is for SQL Server Management Studio Express (Tools only).

    Rick Byham, Microsoft, SQL Server Books Online, Implies no warranty

    Tuesday, February 05, 2013 5:01 PM
  • Hi Tom,

    What you are seeing are user instances. Sql Express only loads those upon request with a special connection string. It is possible to use Sql Management Studio Express in combination with the SSETool to load an instance so you can management more details:

    Iric Wen
    TechNet Community Support

    Wednesday, February 06, 2013 7:09 AM