Monday, July 7, 2014

T-SQL: MDF files in use

List the MDF file for every database in SQL Instance

declare @files table (
    db_name sysname,
    physical_name nvarchar(260)
)

insert into @files
    exec sp_MSforeachdb 'select "?", physical_name from ?.sys.database_files'

select db_name, physical_name 
    from @files


1 comment:

  1. List of Affordable Packers and Movers in Bangalore for Local Shifting Near Me. Hire Cheap And Best Rate For Packers And Movers Bangalore With Approx Charges, Review And Rating For Local House Shifting Services
    @ Local Packers And Movers Bangalore

    ReplyDelete