Cursors (T-SQL)

Microsoft® SQL Server™ statements produce a complete result set, but there are times when the results are best processed one row at a time. Opening a cursor on a result set allows processing the result set one row at a time. SQL Server version 7.0 also introduces assigning a cursor to a variable or parameter with a cursor data type.

Cursor operations are supported on these statements:

DECLARE CURSOR CLOSE
DECLARE @local_variable DEALLOCATE
OPEN UPDATE
SET DELETE
FETCH CREATE PROCEDURE

These system functions and system stored procedures also support cursors:

@@CURSOR_ROWS sp_describe_cursor
@@FETCH_STATUS sp_describe_cursor_columns
CURSOR_STATUS sp_describe_cursor_tables
sp_cursor_list  

See Also

Cursors


(c) 1988-98 Microsoft Corporation. All Rights Reserved.