The SET CUSORTYPE statement sets the use of standard (DB-Library) or browse (one connection per cursor) cursors.
SET CURSORTYPE {CUR_BROWSE | CUR_STANDARD}
After this statement is issued, it affects all subsequent cursor OPEN statements. Using the DECLARE CURSOR FOR UPDATE statement has the same effect as SET CURSORTYPE CUR_STANDARD.
To do positioned update or delete operations on a browse cursor, the SELECT statement used to open the browse cursor must include a FOR BROWSE clause, and the table must include a timestamp column.
The SELECT statement used to open a standard cursor cannot contain any of the following Transact-SQL clauses:
FOR BROWSE | COMPUTE |
SELECT INTO | UNION |
For more information about restrictions on standard cursors with a SCROLLOPTION of DYNAMIC, see SET SCROLLOPTION.
If a cursor definition violates any of the conditions noted earlier, a SQLCODE of
-19521 is generated.
SQL Server treats each browse cursor connection as a different user. Locks held by one browse cursor can block operations attempted by other browse cursors. Because standard cursors share the same connection to SQL Server used by the application, using standard cursors eliminates potential browse cursor locking problems.
EXEC SQL SET CURSORTYPE CUR_STANDARD;
DECLARE CURSOR | Standard DB-Library Cursors |
SET CONCURRENCY | Browse Cursors |
SET FETCHBUFFER |