November 23, 2010 at 11:52 pm
In a stored procedure i am using cursor inside the BEGIN TRY n END TRY... in CATCH block, how can i know the the cursor is open?.. is there any possible to identify whether the cursor is open or not?... any help pls?
November 25, 2010 at 3:26 am
Use the CURSOR_STATUS function. See BOL for the parameters and return values.
November 25, 2010 at 3:44 am
You can also use @@FETCH_STATUS - again, please refer BOL for further details.
Thanks & Regards,
Nakul Vachhrajani.
http://nakulvachhrajani.com
Follow me on
Twitter: @sqltwins
November 25, 2010 at 3:58 am
I'm curious about how @@FETCH_STATUS tells you anything about whether the cursor's open or not. Surely this just tells you about the status of any fetches that have been done.
Also, since this is a global function, if your cursor hasn't opened, @@FETCH_STATUS could be telling you about some previously used, unrelated cursor.
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply