Find SQL Server Database Physical File Location

Following code will display the list of database name with the physical location of that database .mdf file in your computer.

  1. SELECT name, physical_name FROM sys.master_files  
When you run this command it will show following output.

SQL Query

Note: Path and the database name will be different based on your database list.

Ebook Download
View all
Learn
View all