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 |
|
|
|
>=aps-pdw-2016 || =azure-sqldw-latest || >=sql-server-2016 || >=sql-server-linux-2017 || =azuresqldb-mi-current |
[!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
sp_execute handle OUTPUT
[ , bound_param ] [ , ...n ]
[ ; ]
[!INCLUDE extended-stored-procedures]
The handle value returned by sp_prepare
. The required handle parameter is int, and can't be NULL
.
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>
.