September 2010
Intermediate to advanced
1704 pages
111h 8m
English
CURSOR Variables in Stored ProceduresAnother method available in SQL Server 2008 for passing cursor result sets between stored procedures is using the cursor data type. The cursor data type can be used to bind a cursor result set to a local variable, and that variable can then be used to manage and access the cursor result set. Cursor variables can be referenced in any of the cursor management statements: OPEN, FETCH, CLOSE, and DEALLOCATE.
A stored procedure can pass cursor variables as output parameters only; cursor variables cannot be passed as input parameters. When defining a CURSOR output parameter, you must also specify the VARYING keyword.
When assigning a cursor to a cursor variable, you must use the SET command because an assignment ...