March 31, 2015 at 1:54 pm
I was looking for the date value of when an index was created, there is no date field in sysindexes, and linking back to objects is not returing right value. Anyone know where to look?
March 31, 2015 at 2:13 pm
I had the same question some days ago and only found that the index creation affected the column modify_date in sys.objects. If the index supports a constraint, you could query for the constraint create_date.
By the way, you shouldn't be using sysindexes.
From Books OnLine
:exclamation: ImportantThis SQL Server 2000 system table is included as a view for backward compatibility. We recommend that you use the current SQL Server system views instead. To find the equivalent system view or views, see Mapping SQL Server 2000 System Tables to SQL Server 2005 System Views. This feature will be removed in a future version of Microsoft SQL Server. Avoid using this feature in new development work, and plan to modify applications that currently use this feature.
April 1, 2015 at 5:12 am
if the index is a PK constraint the Create date is on sys.objects
-----------------------------------------------------------------------------------------------------------
"Ya can't make an omelette without breaking just a few eggs" 😉
April 4, 2015 at 3:27 am
For indices other than primary keys the answer is NO, the closest would be the date for the statistics
😎
SELECT
I.object_id
,I.index_id
,I.name AS IDX_NAME
,OBJECT_NAME(I.object_id) AS OBJ_NAME
,STATS_DATE(I.object_id, I.index_id) AS IDX_STATS_DATE
FROM sys.indexes I
WHERE STATS_DATE(I.object_id, I.index_id) IS NOT NULL;
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply