SQL instances running a lot of databases can get a bit confusing as to what is kept where. Especially if said instance was setup by someone else in times prior. To that end, there is a very handy query you can run in SSMS to quickly return the on-disk file locations of all SQL data files. You can use this query exactly as-is with no modification:

SELECT name, physical_name AS current_file_location
FROM sys.master_files

This will output a nicely formatted table including filename and folder path, including the Master database and Temp Database files.


Reference:
http://blog.sqlauthority.com/2009/02/17/sql-server-find-current-location-of-data-and-log-file-of-all-the-database/

1 of 1

This post has no comments. Be the first to leave one!

Join the discussion

Your email address will not be published. Required fields are marked *