Friday, 9 January 2015

How to check latest statistics updated date in SQL SERVER

How to check latest statistics updated date in sql server


SELECT SCHEMA_NAME(schema_id) AS SchemaName
      , OBJECT_NAME(o.object_id)  AS ObjectName
      ,type  AS ObjectType
      ,s.name  AS StatsName
      , STATS_DATE(o.object_id, stats_id) AS StatsDate
FROM sys.stats s INNER JOIN sys.objects o ON o.object_id=s.object_id
WHERE OBJECTPROPERTY(o.object_id, N'ISMSShipped') = 0
AND LEFT(s.Name, 4) != '_WA_'
ORDER BY ObjectType, SchemaName, ObjectName, StatsName;

No comments:

Post a Comment