Search code examples
mdfsql-serverdatabasefile

What is an MDF file?


Is this like an “embedded” database of sorts? A file containing a built in database?


Solution

  • SQL Server databases use two files - an MDF file, known as the primary database file, which contains the schema and data, and a LDF file, which contains the logs. See wikipedia. A database may also use secondary database file, which normally uses a .ndf extension.

    As John S. indicates, these file extensions are purely convention - you can use whatever you want, although I can't think of a good reason to do that.

    More info on MSDN here and in Beginning SQL Server 2005 Administation (Google Books) here.