July 9, 2017 at 8:33 pm
How to find Index created date details in my SQL server database?.Any query to find for this.In my database lot of indexes are there.I want to know index created date with name details.
July 9, 2017 at 8:56 pm
With the exceptions of indexes created as part of a primary key or unique constraint, then no. SQL does not save the creation/modify date of indexes. you can get the create_date and modify_date from sysobjects for the PK/UQs only.
That date doesn't really have much value, if it was exposed.
going forward, if you needed to know who was creating indexes behind your back(Bobby Bouche!)
then you could add an extended event that captures DDL statements, or a DDL trigger.
you can kinda-sorta find a date via the STATS_DATE function, that gives you the last time an index was rebuilt/reorganized, or a statistic was last updated. that's only useful if you never, ever urebuild stats or indexes, though. it might imply a newly created indexes date though.
SELECT STATS_DATE([so].[object_id], [si].[index_id]) [StatsDate] ,
[si].[name] [IndexName] ,
SCHEMA_NAME([so].[schema_id]) + N'.' + [so].[name] [TableName] ,
[so].[object_id] ,
[si].[index_id]
FROM [sys].[indexes] [si]
INNER JOIN [sys].[tables] [so] ON [so].[object_id] = [si].[object_id]
ORDER BY 1 DESC;
Lowell
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply