A question of @@GLOBAL importance

  • I wrote a Stored proc that uses @@FETCH_STATUS and @@TRANCOUNT.

    Suppose that 2 or more users just happen to invoke this stored proc at the "same time". Is it possible that one user will get the

    @@FETCH_STATUS or @@TRANCOUNT global values intended for the other user? I hope not but why not?

    TIA,

    Bill

  • Hi in bol @@TRANCOUNT

    Returns the number of active transactions for the current connection

    Because every user that executes a stored procedure is a new connection you only get the value for the user in the current connection.

  • From BOL on @@FETCH_STATUS

    quote:


    Returns the status of the last cursor FETCH statement issued against any cursor currently opened by the connection.


    Only return the @@FETCH_STATUS of the cursor it is run against on the connection. Not all cursors, nor any other connection.

    "Don't roll your eyes at me. I will tape them in place." (Teacher on Boston Public)

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

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