syscursors |
Contains the attributes of a server cursor. This table is stored in the master database. The syscursors table is used by the sp_describe_cursor system stored procedure to report the attributes of a server cursor, and the sp_cursor_list system stored procedures to report the attributes of server cursors currently open for the connection.
Column name | Data type | Description |
cursor_handle | int | A unique value for the cursor within the scope of the server. |
cursor_name | sysname, nullable | Name of the cursor. |
status | int | Same values as reported by the CURSOR_STATUS system function:
1 = The cursor referenced by the cursor name or variable is open. If the cursor is insensitive, static, or keyset, it has at least one row. If the cursor is dynamic, the result set has zero or more rows. 0 = The cursor referenced by the cursor name or variable is open but has no rows. Dynamic cursors never return this value. -1 = The cursor referenced by the cursor name or variable is closed. -2 = Applies only to cursor variables. There is no cursor assigned to the variable. Possibly, an OUTPUT parameter assigned a cursor to the variable, but the stored procedure closed the cursor before returning. -3 = A cursor or cursor variable with the specified name does not exist, or the cursor variable has not had a cursor allocated to it. |
model | tinyint | 1 = Insensitive (or static) 2 = Keyset 3 = Dynamic 4 = Fast Forward |
concurrency | tinyint | 1 = Read-only 2 = Scroll locks 3 = Optimistic |
scrollable | tinyint | 0 = Forward-only 1 = Scrollable |
open_status | tinyint | 0 = Closed 1 = Open |
cursor_rows | decimal(10,0) | Number of qualifying rows in the result set. |
fetch_status | smallint | Status of the last fetch on this cursor.
0 = Fetch successful. -1 = Fetch failed or is beyond the bounds of the cursor. -2 = The requested row is missing. -9 = There has been no fetch on the cursor. |
column_count | smallint | Number of columns in the cursor result set. |
row_count | decimal(10,0) | Number of rows affected by the last operation on the cursor. |
last_operation | tinyint | Last operation performed on the cursor:
0 = No operations have been performed on the cursor. 1 = OPEN 2 = FETCH 3 = INSERT 4 = UPDATE 5 = DELETE 6 = CLOSE 7 = DEALLOCATE |
syscursortables |
Contains the base tables referenced by a server cursor. This table is stored in the master database. The syscursortables table is used by the sp_describe_cursor_tables system stored procedures to report the base tables referenced by a server cursor.
Column name | Data type | Description |
cursor_handle | int | A unique value for the cursor within the scope of the server. |
table owner | sysname, nullable | User ID of the table owner. |
table_name | sysname, nullable | Name of the base table. |
optimizer_hints | smallint | Bitmap consisting of one or more of:
1 = Row-level locking (ROWLOCK) 4 = Page-level locking (PAGELOCK) 8 = Table Lock (TABLOCK) 16 = Exclusive table lock (TABLOCKX) 32 = Update lock (UPDLOCK) 64 = No lock (NOLOCK) 128 = Fast first-row option (FASTFIRST) 4096 = Read repeatable semantic when used with declare cursor (HOLDLOCK) |
lock_type | smallint | Scroll-lock type requested either explicitly or implicitly for each base table that underlies this cursor. The value can be:
0 = None 1 = Shared 3 = Update |
server_name | sysname, nullable | Name of the linked server the table resides on. NULL if OPENQUERY or OPENROWSET are used. |
objectid | int | Object ID of the table. 0 if OPENQUERY or OPENROWSET are used. |
dbid | int | ID of the database the table resides in. 0 if OPENQUERY or OPENROWSET are used. |
dbname | sysname, nullable | Name of the database the table resides in. NULL if OPENQUERY or OPENROWSET are used. |