Wise man or Wise guy? You Decide

Just another WordPress.com weblog

What are EventSubClass and ObjectType in my Trace File?

Posted by sqlwiseguy on May 13, 2009

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.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: