Have you ever wondered what that 1 in EventSubClass or ObjectType 8277 mean in that trace file you are querying using fn_trace_gettable? If I open the file in Profiler I see EventSubClass 0-Begin and for ObjectType I see 8277-U, but when I use fn_trace_gettable I only see 0 and 8277. Well, today I found out how to find out what those nice integers mean. Both translations can be found in the sys.trace_subclass_values system view. This view consists of the trace_event_id (eventclass in the trace file), trace_column_id, subclass_name, and subclass_value. So the query:
SELECT
TE.NAME AS event_name,
TSV.subclass_name,
TSV.subclass_value
FROM
sys.trace_events AS TE JOIN
sys.trace_subclass_values AS TSV ON
TE.trace_event_id = TSV.trace_event_id JOIN
sys.trace_columns AS TC ON
TSV.trace_column_id = TC.trace_column_id
WHERE
TC.[name] = 'EventSubClass'
ORDER BY
event_name
Will return all the EventSubClass names for each event and:
SELECT
TE.NAME AS event_name,
TSV.subclass_name,
TSV.subclass_value
FROM
sys.trace_events AS TE JOIN
sys.trace_subclass_values AS TSV ON
TE.trace_event_id = TSV.trace_event_id JOIN
sys.trace_columns AS TC ON
TSV.trace_column_id = TC.trace_column_id
WHERE
TC.[name] = 'ObjectType'
ORDER BY
event_name
returns all the ObjectType names, well actually abbreviations. If you really want to know the names of the ObjectTypes you need to look
here. Or as Brad McGahee recommends in his book
Mastering SQL Server Profiler you can search for “ObjectType Trace Event Column” in BOL.
No comments:
Post a Comment
So what do you think I am?