indexing - Finding indexes on a table in SQL Server 2008 R2 that were created within last 15 days -
i created new indexes within last 15 days on couple of tables in sql server 2008 r2.
knowing table name, possible determine indexes created in last 15 days?
not big fan of backward compatibility views sysindexes because won't able rely on them forever, , because join proposed in other answer filters on create date of table, not index. normal indexes, sql server not log date/time of when index created (though can constraints).
you can find information (as created index, can't metadata constraints) in default trace, if 15 days haven't rolled out yet:
use your_database; go declare @path nvarchar(260); select @path = reverse(substring(reverse([path]), charindex(char(92), reverse([path])), 260)) + n'log.trc' sys.traces is_default = 1; select hostname, loginname, applicationname, starttime, [index] = objectname, indexid sys.fn_trace_gettable(@path, default) eventclass = 46 , eventsubclass = 1 , databasename = db_name() , objectid = object_id('dbo.your_table_name') , indexid not null , starttime >= convert(date, dateadd(day, -15, getdate())) order endtime desc; going forward, use ddl trigger log information proactively, don't have scramble , rely on age of default trace audit these activities...
Comments
Post a Comment