Skip to content

Latest commit

 

History

History
55 lines (41 loc) · 1.94 KB

sp-execute-transact-sql.md

File metadata and controls

55 lines (41 loc) · 1.94 KB
title description author ms.author ms.reviewer ms.date ms.service ms.subservice ms.topic f1_keywords helpviewer_keywords dev_langs monikerRange
sp_execute (Transact-SQL)
sp_execute executes a prepared Transact-SQL statement using a specified handle and optional parameter value.
markingmyname
maghan
randolphwest
03/07/2025
sql
system-objects
reference
sp_cursor_execute
sp_cursor_execute_TSQL
sp_execute
TSQL
>=aps-pdw-2016 || =azure-sqldw-latest || >=sql-server-2016 || >=sql-server-linux-2017 || =azuresqldb-mi-current

sp_execute (Transact-SQL)

[!INCLUDE sql-asdbmi-asa-pdw]

Executes a prepared [!INCLUDE tsql] statement using a specified handle and optional parameter value. sp_execute is invoked by specifying ID = 12 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_execute handle OUTPUT
    [ , bound_param ] [ , ...n ]
[ ; ]

Arguments

[!INCLUDE extended-stored-procedures]

handle

The handle value returned by sp_prepare. The required handle parameter is int, and can't be NULL.

bound_param

Signifies the use of extra parameters. The bound_param parameter is any data type, to signify more parameters for the procedure, and can't be NULL.

Note

bound_param must match the declarations made by the sp_prepare @params value, and can be in the form @name = <value> or <value>.

Related content