--- title: "sp_cursorclose (Transact-SQL) | Microsoft Docs" ms.custom: "" ms.date: "03/14/2017" ms.prod: "sql-non-specified" ms.reviewer: "" ms.suite: "" ms.technology: - "database-engine" ms.tgt_pltfrm: "" ms.topic: "language-reference" f1_keywords: - "sp_cursor_close_TSQL" - "sp_cursor_close" dev_langs: - "TSQL" helpviewer_keywords: - "sp_cursorclose" ms.assetid: d9b7b44d-cdff-456e-97df-7031a3b9beb6 caps.latest.revision: 7 author: "BYHAM" ms.author: "rickbyh" manager: "jhubbard" --- # sp_cursorclose (Transact-SQL) [!INCLUDE[tsql-appliesto-ss2008-xxxx-xxxx-xxx_md](../../includes/tsql-appliesto-ss2008-xxxx-xxxx-xxx-md.md)] 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**: [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)] ([!INCLUDE[ssKatmai](../../includes/sskatmai-md.md)] through [current version](http://go.microsoft.com/fwlink/p/?LinkId=299658)).| ![Topic link icon](../../database-engine/configure-windows/media/topic-link.gif "Topic link icon") [Transact-SQL Syntax Conventions](../../t-sql/language-elements/transact-sql-syntax-conventions-transact-sql.md) ## Syntax ``` sp_cursorclose cursor ``` ## Arguments *cursor* Is a cursor *handle* value generated by [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)] and returned by the sp_cursoropen procedure. *cursor* is a required parameter that calls for an **int** input value. > [!NOTE] > An input value of -1 will apply towards all cursors on the current connection. ## Remarks *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. ## See Also [sp_cursoropen (Transact-SQL)](../../relational-databases/system-stored-procedures/sp-cursoropen-transact-sql.md) [System Stored Procedures (Transact-SQL)](../../relational-databases/system-stored-procedures/system-stored-procedures-transact-sql.md)