View Full Version : Find location of MSSQL server

03-10-2006, 11:15 AM
I need to put my database (mdf and ldf) files into the local MSSQL server directory, is there a quick and simple way to check if it exists, and to copy my mdfs and ldfs there if it does?

Thanks a million

03-16-2006, 10:45 AM
If you are using the SQL 2005 version I found the following keys can be used to determine the data and log file locations.

Main Key:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL.1\MSSQLServer\Parameters

The subkeys with the data and log file locations:

The strings look like this for your info:
-dC:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\DATA\master.mdf