Transact-SQL Cursor Syntax
A number of commands and functions relate to cursors. Table 14.2 summarizes them. The following subsections cover these commands in more detail.
|Command or Function||Purpose|
|DECLARE CURSOR||Defines a cursor|
|OPEN||Opens a cursor so that data may be retrieved from it|
|FETCH||Fetches a single row from the cursor|
|CLOSE||Closes the cursor, leaving intact the internal structures that service it|
|DEALLOCATE||Frees the cursor's internal structures|
|@@CURSOR_ROWS||Returns the number of rows exposed by the cursor|
|@@FETCH_STATUS||Indicates the success or failure of the last FETCH|
|CURSOR_STATUS||Reports status information for cursors and cursor variables|
DECLARE CURSOR defines cursors. There ...