Jasinski Technical Wiki

Navigation

Home Page
Index
All Pages

Quick Search
»
Advanced Search »

Contributor Links

Create a new Page
Administration
File Management
Login/Logout
Your Profile

Other Wiki Sections

Software

PoweredBy

List of Database Files for an Instance - SQL Server

RSS
Modified on Fri, Jan 08, 2016, 9:36 PM by Administrator Categorized as SQL Server, SQL Server System Tables

Overview

The following SQL statement gives a list of all database files on a SQL Server instance for all databases.

Code

select 
     DatabaseName = d.name
    ,FullFileName = f.physical_name
from 
    sys.master_files f
    inner join master.sys.databases d
        on d.database_id = f.database_id
where 1=1
    and d.name not in ('master', 'msdb', 'tempdb')
order by
    d.name
    ,f.physical_name

ScrewTurn Wiki version 3.0.1.400. Some of the icons created by FamFamFam. Except where noted, all contents Copyright © 1999-2024, Patrick Jasinski.