December 29, 2010

Profiler EventId Lookups

Filed under: SQLServerPedia Syndication,T-SQL — Joe Casella @ 12:46 am
Tags: , ,

The SQL Profiler UI displays a description of the Event Class for each event in a trace.  When you save the trace to a table, however, the Event Class value is stored as a number.  If you need the descriptions, just join to the sys.trace_events DMV:

  1. SELECT tt.EventClass
  2.    , EventClass =
  3. FROM PracticeData.dbo.MyTraceTable  tt
  4.   JOIN sys.trace_eventsee
  5.   on tt.EventClass = ee.category_id

The Event Category is available in sys.trace_categories:

  1. SELECT tt.EventClass
  2.    , EventCategory =
  3.    , EventClass =
  4. FROM PracticeData.dbo.MyTraceTable  tt
  5. JOIN sys.trace_events  ee
  6.   on tt.EventClass = ee.category_id
  7. JOIN sys.trace_categories cc
  8.   on ee.category_id = cc.category_id

More information on sys.trace_events and sys.trace_categories can be found in Books Online.


Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a Reply

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

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

Google photo

You are commenting using your Google 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 )

Connecting to %s

Blog at

%d bloggers like this: