Export (0) Print
Expand All

cursor (Transact-SQL)

Applies To: SQL Server 2014, SQL Server 2016 Preview

Topic Status: Some information in this topic is preview and subject to change in future releases. Preview information describes new features or changes to existing features in Microsoft SQL Server 2016 Community Technology Preview 2 (CTP2).

A data type for variables or stored procedure OUTPUT parameters that contain a reference to a cursor.

Applies to: SQL Server (SQL Server 2008 through current version), Azure SQL Database.

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_name output column of sp_cursor_list and sp_describe_cursor returns the name of the cursor variable.

Any variables created with the cursor data type are nullable.

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

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

© 2015 Microsoft