Use sp_cursorinfo to find information about a cursor’s name, its current status, and its result columns. This example displays information authors_crsr:
sp_cursorinfo 0, authors_crsr
Cursor name ’authors_crsr’ is declared at nesting level ’0’. The cursor id is 327681 The cursor has been successfully opened 1 times The cursor was compiled at isolation level 1. The cursor is not open. The cursor will remain open when a transaction is committed or rolled back. The number of rows returned for each FETCH is 1. The cursor is updatable. There are 3 columns returned by this cursor.
The result columns are: Name = ’au_id’, Table = ’authors’, Type = ID, Length = 11 (updatable) Name = ’au_lname’, Table = ’authors’, Type = VARCHAR, Length = 40 (updatable) Name = ’au_fname’, Table = ’authors’, Type = VARCHAR, Length = 20 (updatable)
You can also check the status of a cursor using the @@sqlstatus and @@rowcount global variables. See “Checking the cursor status” and “Checking the number of rows fetched”.
For more information about sp_cursorinfo, see the Reference Manual.