Find Current Location of Data and Log Files for SQL Server

This content is 7 years old.A quick method to find all the data and log file paths for all databases on a database server instance. SELECT name, physical_name AS current_file_location FROM sys.master_files Example Output: name current_file_location master C:Program FilesMicrosoft SQL ServerMSSQL10.MSSQLSERVERMSSQLDATAmaster.mdf mastlog C:Program FilesMicrosoft SQL ServerMSSQL10.MSSQLSERVERMSSQLDATAmastlog.ldf tempdev E:MSSQLData empDB.MDF templog C:Program FilesMicrosoft SQL ServerMSSQL10.MSSQLSERVERMSSQLDATA emplog.LDF … Read moreFind Current Location of Data and Log Files for SQL Server