August 8, 2011 at 2:44 pm
Hi everyone,
Just curious if anyone has a script to see when were the indexes last rebuilt in a database? I've a query which uses STATS_DATE ( A.id , indid ) function. I think it gives the statistics updated date but not the index created date.
Thanks,
Sunil.
August 8, 2011 at 4:21 pm
This will return the time indexes were last updated:
Whoops:
STAT_DATE Returns the date that the statistics for the specified index were last updated.
Edited first line of text to:
This will return the time indexes statistics were last updated
SELECT 'Index Name' = i.name, OBJECT_NAME(i.id) AS 'Table Name',
Case Indid
WHEN 1 THEN 'Clustered'
ELSE 'Non-clustered'
End 'Type',
'Last Updated' = STATS_DATE(i.id, i.indid),rowmodctr AS
'# Rows inserted deleted or updated', i.keys
FROM sysobjects o, sysindexes i
WHERE o.id = i.id AND (o.type <> 'S' AND indid <> 0 AND indid <> 255)
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply