Map SQL Server Profiler EventClass ID to its name in a saved trace table

Map SQL Server Profiler EventClass ID to its name in a saved trace table

If you've ever worked with SQL Server profiler then you're familiar with the EventClass column in the trace.

It tells you what event is being monitored for each row. When you save this trace to a table you can see

that the EventClass no longer has a description but an ID. So how do you map this to a description?

If you know where to look it's amazingly simple but if you don't here's a hint: sys.trace_events

Here's a script to help you out:

SELECT   TE.name, T.*
FROM     dbo.Trace T -- table that contains the trace results
         JOIN sys.trace_events TE ON T.EventClass = TE.trace_event_id
ORDER BY RowNumber
posted @ 2008-06-15 11:46  代码乱了  阅读(...)  评论(...编辑  收藏