What is an MDF file?

NewGuy picture NewGuy · Jul 24, 2009 · Viewed 348.6k times · Source

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

Answer

Jon Galloway picture Jon Galloway · Jul 24, 2009

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.