sp_cursorclose (Transact-SQL)


THIS TOPIC APPLIES TO:yesSQL Server (starting with 2008)noAzure SQL DatabasenoAzure SQL Data Warehouse noParallel Data Warehouse

Closes and de-allocates the cursor, as well as 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.

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

Topic link icon Transact-SQL Syntax Conventions

sp_cursorclose cursor  

Is a cursor handle value generated by SQL Server and returned by the sp_cursoropen procedure. cursor is a required parameter that calls for an int input value.

System_CAPS_ICON_note.jpg Note

An input value of -1 will apply towards all cursors on the current connection.

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

RPC status indicates overall success or failure.

DONE rowcount is always 0.

sp_cursoropen (Transact-SQL)
System Stored Procedures (Transact-SQL)

Community Additions