April 12, 2005 at 7:54 am
Hi,
1.I need to know how to identify particular cursor
is open or not
2. How to close all the open cursors in one command
Thanks in advance
Ramesh
April 12, 2005 at 9:06 am
All cursors whether in your scope or not or just those in your scope, either way I believe there is a system XP or SP for that but don't have BOL handy.
April 12, 2005 at 11:58 pm
You must use the Built-in CURSOR_STATUS function to identify whether ur cursor is open or not.
ex:
IF Cursor_Status('local','<Cursor name>') >= 0
CLOSE <Cursor name>
DEALLOCATE <Cursor name>
I guess there are no way to close all the open cursors in your program.... So u must check the cursor status and close the cursors at the end of ur program.
April 13, 2005 at 7:30 am
loop through the cursor returned by sp_cursor_list, close and deallocate each open cursor. haven't actually used it; just read in BOL.
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply