Skip to content

How to List the Database Name and File Locations

List the database name, logical names and locations of the DB log and database files;

EXECUTE sp_msforeachdb 'use ?; select DB_NAME(); select name, filename from [?].sys.sysfiles'

SHARE THIS POST: