让保存在Profiler trace table中的EventClassID与它的名字对应起来

经常要看sql profiler trace, 觉得光是存储为文件看起来还不是足够方便, 存储到数据库的表中后, 你就可以随便的查询了.

 

但是, 保存下来的表中EventClassID这一列显示的是数字, 而不像在Profiler应用程序中显示为

RPC:Starting
SP:Starting
SP:StmtStarting

等的名字.

 

上网找了一下, 发现了下面的脚本, 可以完成把EventClassID显示为名字的方法.

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

 

脚本来源:

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

http://weblogs.sqlteam.com/mladenp/archive/2007/11/09/Map-SQL-Server-Profiler-EventClass-ID-to-its-name-in.aspx

posted on 2010-04-19 18:50  中道学友  阅读(363)  评论(0编辑  收藏  举报

导航

技术追求准确,态度积极向上