xp_trace_geteventnames (T-SQL)

Lists the names of all event classes.

Syntax

xp_trace_geteventnames [event_class]

Arguments
event_class
Is an integer representing the class of events to list.
Return Code Values

0 (success) or >1 (failure)

Result Sets

xp_trace_geteventnames returns this result set when event_class is not specified.

Column name Description
EventClass Event class
EventName Name for the corresponding event class

Remarks

If event_class is specified, only that event class is returned. Given an event class value, it returns the name of that event class. If event_class is not specified, all event classes and their names are listed

Set the events available to trace by using xp_trace_seteventclassrequired.

Generate user configurable events by executing xp_trace_generate_event.

Permissions

Execute permissions for xp_trace_geteventnames default to members of the sysadmin fixed server role but can be granted to other users.

Examples
A. Retrieve all event class information

This example retrieves the names of all event classes that are available to trace.

USE master

EXEC xp_trace_geteventnames

  

Here is the result set:

EventClass  EventName                               

----------- -----------------------------------------

0           TraceStart

1           TracePause

2           TraceRestart

3           TraceAutoPause

4           TraceAutoRestart

5           TraceStop

6           EventRequired

7           FilterChanged

8           8

9           9

10          RPC:Completed

11          RPC:Starting

12          SQL:BatchCompleted

13          SQL:BatchStarting

14          Connect

15          Disconnect

16          Attention

17          ExistingConnection

18          ServiceControl

19          DTCTransaction

20          LoginFailed

21          EventLog

22          ErrorLog

23          Lock:Released

24          Lock:Acquired

25          Lock:Deadlock

26          Lock:Cancel

27          Lock:Timeout

28          Insert

29          Update

30          Delete

31          Select

32          ConnectionBeingKilled

33          Exception

34          SP:CacheMiss

35          SP:CacheInsert

36          SP:CacheRemove

37          SP:Recompile

38          SP:CacheHit

39          SP:ExecContextHit

40          SQL:StmtStarting

41          SQL:StmtCompleted

42          SP:Starting

43          SP:Completed

44          SP:StmtStarting

45          SP:StmtCompleted

46          Object:Created

47          Object:Deleted

48          Object:Opened

49          Object:Closed

50          SQLTransaction

51          Scan:Started

52          Scan:Stopped

53          CursorOpen

54          TransactionLog

55          Hash Warning

56          56

57          57

58          Auto-UpdateStats

59          Lock:Deadlock Chain

60          Lock:Escalation

61          OLEDB Errors

62          Replay Error

63          Replay Internal Error

64          Replay Result Set

65          Replay Result Row

66          66

67          Execution Warnings

68          Execution Plan

69          Sort Warnings

70          CursorPrepare

71          Prepare SQL

72          Exec Prepared SQL

73          Unprepare SQL

74          CursorExecute

75          CursorRecompile

76          CursorImplicitConversion

77          CursorUnprepare

78          CursorClose

79          Missing Column Statstics

80          Missing Join Predicate

81          Server Memory Change

82          UserConfigurable:1

83          UserConfigurable:2

84          UserConfigurable:3

85          UserConfigurable:4

86          UserConfigurable:5

  

(87 row(s) affected)

  


Note TraceStart, TracePause, TraceRestart, TraceAutoPause, TraceAutoRestart, and TraceStop are created by SQL Server Profiler.

ConnectionBeingKilled, Replay Error, Replay Internal Error, Replay Result Set, and Replay Result Row are used by Replay.


B. Retrieve event class name for a specific event class

This example retrieves the event class name (Attention) given the event class number (16).

USE master

EXEC xp_trace_geteventnames 16

  

Here is the result set:

EventClass   EventName                                                   

----------- ------------------------------------------------------------

16          Attention

  

(1 row(s) affected)

  

See Also
Monitoring with SQL Server Profiler xp_trace_seteventclassrequired
xp_trace_eventclassrequired System Stored Procedures (SQL Server Profiler Extended Procedures)

  


(c) 1988-98 Microsoft Corporation. All Rights Reserved.