Skip to content

Latest commit

 

History

History
66 lines (43 loc) · 2.66 KB

cursors-transact-sql.md

File metadata and controls

66 lines (43 loc) · 2.66 KB
title description author ms.author ms.date ms.service ms.subservice ms.topic ms.custom helpviewer_keywords dev_langs monikerRange
Cursors (Transact-SQL)
Cursors (Transact-SQL)
rwestMSFT
randolphwest
03/16/2017
sql
t-sql
reference
ignite-2024
statements [SQL Server], cursors
functions [SQL Server], cursors
cursors [SQL Server], statements
TSQL
=azuresqldb-current || >=sql-server-2016 || >=sql-server-linux-2017 || =azuresqldb-mi-current || =fabric

Cursors (Transact-SQL)

[!INCLUDE SQL Server Azure SQL Database Azure SQL Managed Instance Fabricsqldb]

[!INCLUDEmsCoName] [!INCLUDEssNoVersion] 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. You can assign a cursor to a variable or parameter with a cursor data type.

Cursor operations are supported on these statements:

CLOSE

CREATE PROCEDURE

DEALLOCATE

DECLARE CURSOR

DECLARE @local_variable

DELETE

FETCH

OPEN

UPDATE

SET

These system functions and system stored procedures also support cursors:

@@CURSOR_ROWS

CURSOR_STATUS

@@FETCH_STATUS

sp_cursor_list

sp_describe_cursor

sp_describe_cursor_columns

sp_describe_cursor_tables

See Also

Cursors