次の方法で共有


How to find location of database files(.mdf,.ldf etc .)

Run the following query

SELECT SUBSTRING(physical_name, 1,CHARINDEX(N'master.mdf',LOWER(physical_name)) - 1) Database_File_LocationFROM master.sys.master_filesWHERE database_id = 1 AND FILE_ID = 1

Result will be

 Database_File_Location
--------------------------------------------------------------------------
E:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA\

Above script will give exact location of where the data files of master database is available.