how to know filenames of a given db

  • Hi,

    In SQL Server 2008, in the following query, how can I obtain the filename beside the file_id?

    SELECT i.file_id ,sample_ms ,num_of_reads ,num_of_bytes_read

    FROM sys.dm_io_virtual_file_stats(DB_ID(N'MYDB'), NULL)

  • run the same query, in MYDB, but join sys.dm_io_virtual_file_stats ((DB_ID(N'MYDB'), NULL) to sys.database_files on file_id

  • you may also want to look at sys.master_files it is in the master database however it provides a more global over view for the data you are trying to get at (file ID)

  • Thanks!

    cheers buddy!

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply