sp_execute (Transact-SQL)

Applies to: SQL Server Azure SQL Managed Instance Azure Synapse Analytics Analytics Platform System (PDW)

Executes a prepared Transact-SQL statement using a specified handle and optional parameter value. sp_execute is invoked by specifying ID = 12 in a tabular data stream (TDS) packet.

Transact-SQL syntax conventions

Syntax

sp_execute handle OUTPUT
    [ , bound_param ] [ , ...n ]
[ ; ]

Arguments

Important

Arguments for extended stored procedures must be entered in the specific order as described in the Syntax section. If the parameters are entered out of order, an error message occurs.

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>.