SQL Server: Find Database File Path

Suppose you want to find out the path where the SQL Server database files(mdf and ldf) are located, using a query. You can use system procedure sp_helpdb and system view sysfiles to obtain this information.

The following methods shows the path of the database files for master database

Method 1 : 

EXEC sp_helpdb master

Method 2 : 

select filename from master.sys.sysfiles

Method 3: 

select * from sys.database_files

Method 4: 

select * from sys.database_files

2 comments:

You are so interesting! I do not believe I have read something like that before.
So great to find somebody with a few genuine thoughts on
this subject matter. Seriously.. thank you for starting this up.

This website is something that is required on the web, someone with
a little originality!
my page > Recovering mail from exchange server to Outlook

Post a Comment