Does anyone know what the SQL Server trace Event ID or Event Name for Create Index is or where I could find the answer? I suspect it is 'Alter U开发者_StackOverflow中文版ser Table' but I need to be certain.
In Profiler, what you want is in Objects -> Object:Created
. This will show any DDL events. Then, in the column filters set the Like
filter on the TextData
column to Create Index%
.
For a trace, you want the Object:Created
event (eventId = 46). So something like:
sp_trace_setevent [your trace id]
, @eventid = 46 -- Object:Created
, @columnid = 1 -- TextData column
, [ @on = ] on
sp_trace_setfilter [your trace id]
, @columnid = 1 -- TextData column
, @logical_operator = 0 -- AND
, @comparison_operator = 6 -- LIKE
, @value = 'Create Index%'
精彩评论