Removes events from the trace queue created with xp_trace_addnewqueue and returns the events as a result set.
xp_trace_getevents {queue_handle, is_fulltext, is_integerevents}
[, number_of_events]
Value | Description |
---|---|
0 | Returns up to 255 characters. |
1 | Returns full text of up to 2,147,483,648 characters (2^31). ( ) |
Value | Description |
---|---|
0 | Displays event as a string. |
1 | Displays event as a integer. |
0 (success) or >1 (failure)
Column name | Description |
---|---|
EventClass | Event class name |
ConnectionId | Connection ID removing events from the trace queue |
NTUser | Windows NT username |
Host | Computer name |
Application | Application name removing events from the trace queue |
StartTime | Time event removal began |
Execute permissions for xp_trace_getevents default to members of the sysadmin fixed server role but can be granted to other users.
This example retrieves all events from the trace queue, returns the full text event information, and returns each event as a string (rather than an integer).
USE master
DECLARE @queue_handle int, @column_value int
SET @column_value = 16|32|8192|128|512
EXEC xp_trace_addnewqueue 1000,
5,
95,
90,
@column_value,
@queue_handle OUTPUT
EXEC xp_trace_getevents @queue_handle,
1,
0
This example retrieves all events from the trace queue, displays the event information as a maximum of 255 characters, and displays each event as an integer (rather than a string).
USE master
DECLARE @queue_handle int, @column_value int
SET @column_value = 16|32|8192|128|512
EXEC xp_trace_addnewqueue 1000,
5,
95,
90,
@column_value,
@queue_handle OUTPUT
EXEC xp_trace_getevents @queue_handle,
0,
1
Monitoring with SQL Server Profiler | xp_trace_geteventnames |
xp_trace_addnewqueue | System Stored Procedures (SQL Server Profiler Extended Procedures) |
xp_trace_eventclassrequired |