DMV Queries - Get DMV/DMF List


                 SQL Server 2000:        Not Supported
                 SQL Server 2005:        Tested
                 SQL Server 2008:        Tested
                 SQL Server 2008R2:    Tested
                 SQL Server 2012:        Not Tested        


Author:    ChillyDBA
Date:        29 Jun 2012


Since their introduction in SQL Server 2005, DMVs/DMFs have become a staple for DBAs who want/need to examine in-depth aspects of SQL Server management and structure.
Each new SQL Server version (and sometimes Service Pack) broadens the scope of these valuable assets.  SQL Server 2008 R2 now has in excess of 130.

It can sometimes be a challenge to find exactly the information that you require, as SQL BOL is not really designed for just browsing across the collection of DMVs.
I therefore created a quick query to list all the DMVs and DMFs along with columns and data types.  This is easier to browse initially, with BOL providing the in-depth information once the required DMV/DMF has been identified.


--Listing all the DMV/DMF along with its columns, their 

--data types and size

SCHEMA_NAME(so.schema_id)   AS SchemaName,                     AS DMVName,                     AS ColumnName,                      AS DataType,
sc.column_id                AS ColumnOrder,
sc.max_length               AS MaxLength,
sc.PRECISION                AS PRECISION,
sc.scale                    AS Scale
FROM sys.system_objects so
INNER JOIN sys.system_columns sc
INNER JOIN sys.types t
ON sc.user_type_id = t.user_type_id
WHERE LIKE 'dm_%'  
ORDER BY, sc.column_id

Andy Hughes,
Jun 29, 2012, 7:57 AM