Is it possible to list information about the files (MDF/LDF) of all databases on an SQL Server?
I\'d like to get a list showing which database is using what files on th
If you want get location of Database you can check Get All DBs Location.
you can use sys.master_files
for get location of db and sys.databse
to get db name
SELECT
db.name AS DBName,
type_desc AS FileType,
Physical_Name AS Location
FROM
sys.master_files mf
INNER JOIN
sys.databases db ON db.database_id = mf.database_id