Skip to content

Latest commit

 

History

History
70 lines (47 loc) · 2.74 KB

File metadata and controls

70 lines (47 loc) · 2.74 KB
title Cursors (Transact-SQL) | Microsoft Docs
ms.custom
ms.date 03/16/2017
ms.prod sql
ms.prod_service database-engine, sql-database
ms.reviewer
ms.suite sql
ms.technology t-sql
ms.tgt_pltfrm
ms.topic language-reference
dev_langs
TSQL
helpviewer_keywords
statements [SQL Server], cursors
functions [SQL Server], cursors
cursors [SQL Server], statements
ms.assetid 63000023-54fc-4efc-a30f-fb4d4db73aae
caps.latest.revision 15
author douglaslMS
ms.author douglasl
manager craigg

Cursors (Transact-SQL)

[!INCLUDEtsql-appliesto-ss2008-asdb-xxxx-xxx-md]

[!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