Skip to content

Latest commit

 

History

History
55 lines (39 loc) · 1.78 KB

sp-cursorclose-transact-sql.md

File metadata and controls

55 lines (39 loc) · 1.78 KB
title description author ms.author ms.reviewer ms.date ms.service ms.subservice ms.topic f1_keywords helpviewer_keywords dev_langs
sp_cursorclose (Transact-SQL)
sp_cursorclose closes and deallocates the cursor, and releases all associated resources.
markingmyname
maghan
randolphwest
03/07/2025
sql
system-objects
reference
sp_cursor_close_TSQL
sp_cursor_close
sp_cursorclose
TSQL

sp_cursorclose (Transact-SQL)

[!INCLUDE SQL Server]

Closes and deallocates the cursor, and releases all associated resources; that is, it drops the temporary table used in support of KEYSET or STATIC cursor. sp_cursorclose is invoked by specifying ID = 9 in a tabular data stream (TDS) packet.

:::image type="icon" source="../../includes/media/topic-link-icon.svg" border="false"::: Transact-SQL syntax conventions

Syntax

sp_cursorclose cursor
[ ; ]

Arguments

[!INCLUDE extended-stored-procedures]

cursor

A cursor handle value generated by [!INCLUDE ssNoVersion] and returned by the sp_cursoropen procedure. The cursor parameter is int and can't be NULL.

An input value of -1 applies toward all cursors on the current connection.

Remarks

cursor will return error messages if the procedure was run after the cursor was closed, or if an invalid handle is specified.

RPC status indicates overall success or failure.

DONE rowcount is always 0.

Related content