Skip to content

Instantly share code, notes, and snippets.

@veysby
Created January 27, 2015 16:38
Show Gist options
  • Save veysby/4f18e99d206121ee33a6 to your computer and use it in GitHub Desktop.
Save veysby/4f18e99d206121ee33a6 to your computer and use it in GitHub Desktop.
MSSQL: list statistics update date
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;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment