TSQL Query Indexes by date to determine when they are generated?
Is there a way in SQL Server 2008 R2 to detect when an index was created via TSQL? There are no date fields in the sys.indexes table. Thank.
+3
Shane
source
to share
1 answer
You can join it in sys.objects which has a create_date field.
SELECT TOP 10
*
FROM <yourdb>.sys.indexes i
INNER JOIN <yourdb>.sys.objects o ON i.object_id = o.object_id
WHERE o.type NOT IN ('S', 'IT')
ORDER BY create_date DESC
Edit-edit: I shouldn't try to communicate before I had my morning coffee.
The same caveats that are associated with this answer apply, since they are not actually the date the indexes were created, but related to objects.
If that's what you need to do, you can write DDL statements:
http://madhuottapalam.blogspot.ca/2008/06/faq-how-to-find-index-creation-rebuild.html
+1
Kevin Dahl
source
to share