xp_trace_enumqueuehandles (T-SQL)

Numerically lists all currently active trace queue handles.

Syntax

xp_trace_enumqueuehandles [queue_handle]

Arguments
queue_handle
Is an integer, a trace queue handle, from which to begin the numerically ascending trace queue list. If queue_handle is specified, queue_handle and the queue handles that follow it in numeric order are listed. If queue_handle is not specified, all currently defined trace queue handles are returned. queue_handle is used to reference the trace queue and is returned in an output parameter by xp_trace_addnewqueue.
Return Code Values

0 (success) or >1 (failure)

Result Sets

xp_trace_enumqueuehandles returns this result set if no parameters are passed.

Column name Description
QueueHandle Queue number of a currently active trace queue

                    

Permissions

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

Examples
A. List all currently defined trace queue handles

This example lists all currently defined trace queue handles.


Note This example assumes any trace queue handles returned were previously created by executing xp_trace_addnewqueue.


USE master

EXEC xp_trace_enumqueuehandles

  

Here is the result set (output may vary):

QueueHandle

-----------

2

3

4

  

  

(3 row(s) affected)

  

B. List all trace queue handles after a specific trace queue handle

This example lists all trace queues following the trace queue specified with @queue_handle variable.

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_savequeuedefinition @queue_handle,

    'London INSERTs',

    0

EXEC xp_trace_enumqueuehandles @queue_handle

  

Here is the result set:

QueueHandle

-----------

12

  

(1 row(s) affected)

  

See Also
Monitoring with SQL Server Profiler xp_trace_loadqueuedefinition
xp_trace_addnewqueue System Stored Procedures (SQL Server Profiler Extended Procedures)
xp_trace_enumqueuedefname  

  


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