Cari Blog Ini

19 Oktober 2012

How To Check Where Location of Database Files

1. Run this query 

-----code:start--------------------------------------------------------
SELECT
 sys.databases.name AS [Database Name]
 ,suser_sname(owner_sid) AS [Owner Name]
 ,sys.master_files.name AS [File Name]
 ,sys.master_files.physical_name AS [Location]
FROM sys.databases
RIGHT JOIN sys.master_files
ON sys.databases.database_id = sys.master_files.database_id

ORDER BY Location, sys.databases.name
-----code:end--------------------------------------------------------

2. Example Results Messages


Source:
http://www.sqlservercentral.com/scripts/Administration/92378/
Article : Display Names and Locations of SQL Database Files and DB Owners
By Charles Brinkman