Files
DBAdmin/inbox/SQL-Server/Stats/stat_init.sql
T
2026-05-18 06:40:19 +00:00

15 lines
622 B
SQL

select *
from (
SELECT sp.stats_id, name, filter_definition, last_updated, rows, rows_sampled, steps, unfiltered_rows, modification_counter
, stat.object_id
FROM sys.stats AS stat
CROSS APPLY sys.dm_db_stats_properties(stat.object_id, stat.stats_id) AS sp) x
inner join sys.objects obj on x.object_id = obj.object_id
where obj.type = 'U'
order by last_updated desc
SELECT sp.stats_id, name, filter_definition, last_updated, rows, rows_sampled, steps, unfiltered_rows, modification_counter
, stat.object_id
FROM sys.stats AS stat
CROSS APPLY sys.dm_db_stats_properties(stat.object_id, stat.stats_id) AS sp