Where does SQL Server 2005 keep the .mdf files?

kirk.burleson picture kirk.burleson · Aug 17, 2010 · Viewed 33k times · Source

I'm upgrading from SQL Server 2005 to 2008. I've detached the database I need, but can't find it on the file system.

Where does a default installation of SQL Server 2005 store these?

Answer

SQLMenace picture SQLMenace · Aug 17, 2010

try this, run this query

use model
go
SELECT physical_name FROM sys.database_files

in my case on my laptop it is in this folder

C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA\