-- Discovering DMVs and DMFs

-- Querying for DMV and DMF names
select 
		* 
	from 
		sys.system_objects 
	where 
		name LIKE 'dm_%' 
	order by 
		name


-- Querying for columns
select 
		o.name, c.name, t.name, c.column_id, c.max_length, c.precision, c.scale
	from
		sys.system_columns c
		JOIN sys.system_objects o
		ON c.object_id = o.object_id
		JOIN sys.types t
		ON c.user_type_id = t.user_type_id
	where 
		o.name = 'dm_os_loaded_modules' 
	order by 
		o.name


-- Querying for parameters
select 
		o.name, t.name, p.* 
	from
		sys.system_parameters p
		JOIN sys.system_objects o
		ON p.object_id = o.object_id
		JOIN sys.types t
		ON p.user_type_id = t.user_type_id
	where 
		o.name = 'dm_exec_sql_text' 
	order by 
		o.name


-- Querying for parameters
select 
		o.name, t.name, p.* 
	from
		sys.system_parameters p
		JOIN sys.system_objects o
		ON p.object_id = o.object_id
		JOIN sys.types t
		ON p.user_type_id = t.user_type_id
	where 
		o.name like 'dm%' 
	order by 
		o.name



select * from sys.system_parameters