Use of @column_value

  • I am trying to learn how to use the "xp_trace_addnewqueue" stored procedure, but I'm not understanding what I'm reading. For example, what is the purpose of the "SET @column_value" line in this sample code from Books Online?

    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

    Any information you could offer me would be greatly appreciated.

    “If you're not outraged at the media, you haven't been paying attention.”

  • Those values represent the value of the coulms to be included in the output. By using | to generate a bitmask of them together the engine knows which ones to include.

    In the example case you want the following columns

    Connection ID

    Microsoft Windows NT® username

    Start time

    Host name

    Application name

    The is a chart of the whole number values in the BOL topic for this item. So say you want Text data, Binary data and Transaction ID

    From BOL we see the values 1, 2 and 8 which we would do

    1|2|8

    which means the value 11 will be submitted.

    The bitmask looks like this 1011.

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply