TESTING CURSORS

  • IS there any way to test a cursor to see if it is open or closed?

    RICHARD KIRMSS


    RICHARD KIRMSS

  • from BOL:

    CURSOR_STATUS (T-SQL)

    A scalar function that allows the caller of a stored procedure to determine whether or not the procedure has returned a cursor and result set for a given parameter.

    Syntax

    CURSOR_STATUS

    (

    {'local', 'cursor_name'}

    | {'global', 'cursor_name'}

    | {'variable', 'cursor_variable'}

    )

    Return

    value:

    0 -The result set of the cursor is empty

    -1 The cursor is closed. The cursor allocated to this variable is closed.

    -2 Not applicable.

    -3 A cursor with the specified name does not exist.

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

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