cursor (Transact-SQL)

A data type for variables or stored procedure OUTPUT parameters that contain a reference to a cursor. Any variables created with the cursor data type are nullable.

The operations that can reference variables and parameters having a cursor data type are:

  • The DECLARE *@local\_variable* and SET *@local\_variable* statements.

  • The OPEN, FETCH, CLOSE, and DEALLOCATE cursor statements.

  • Stored procedure output parameters.

  • The CURSOR_STATUS function.

  • The sp_cursor_list, sp_describe_cursor, sp_describe_cursor_tables, and sp_describe_cursor_columns system stored procedures.


    The cursor data type cannot be used for a column in a CREATE TABLE statement.


    In SQL Server 2005, the cursor_name output column of sp_cursor_list and sp_describe_cursor returns the name of the cursor variable. In previous releases, this output column returns a system-generated name.

See Also


CAST and CONVERT (Transact-SQL)
Data Types (Transact-SQL)
DECLARE @local\_variable (Transact-SQL)
SET @local\_variable (Transact-SQL)

Other Resources

Data Type Conversion (Database Engine)

Help and Information

Getting SQL Server 2005 Assistance