SQL Trace Helper Functions

version: 1.0.0.1

last updated: 13 April 2005

platform: MSDE 2000 and SQL Server 2000 running Windows NT 4.0 and higher


Description:

Analyzing running SQL Trace traces requires a lot of decoding of integer values, which are documented in SQL Server Books Online; these functions make it easier to interpret traces by returning the textual description of the integer values that represent columns, events, logical and comparison operators.

There are 4 functions:

  • fn_trace_eventname(), returns the event name, based on the event ID
  • fn_trace_columnname(), this returns the column name, based on an column ID
  • fn_trace_comparison_operator(), returns the operator description of a filter clause
  • fn_trace_logical_operator(), returns the logical operator description of a filter clause

Example:

List all events and columns for trace ID 1

select   [Event Name]  = fn_trace_eventname(eventid),
         [Column Name] = fn_trace_columnname(columnid)
from     ::fn_trace_geteventinfo(1)
 

List the filter expression for trace ID 1

select   [Column Name]         = fn_trace_columnname(columnid),
         [Logical Operator]    = fn_trace_logical_operator(logical_operator),
         [Comparison Operator] = fn_trace_comparison_operator(comparison_operator),
         [Value]               = value
from     ::fn_trace_getfilterinfo(1)
 

Results set:

Column Name       Logical Operator    Comparison Operator  Value
----------------- ------------------- -------------------- ------------
ApplicationName   AND                 NOT LIKE             SQL Profiler
 


Download:

Questions or problems regarding this web site should be directed to Web Master.
Copyright © 1991-2005 SQLDev.Net. All rights reserved.
Last modified: 04/06/05.