sp_prepexec (Transact-SQL)
Collapse the table of content
Expand the table of content

sp_prepexec (Transact-SQL)

SQL Server 2008

Prepares and executes a parameterized Transact-SQL statement. sp_prepexec combines the functions of sp_prepare and sp_execute. This is invoked by ID =13 in a tabular data stream (TDS) packet.

Topic link iconTransact-SQL Syntax Conventions

sp_prepexec handle OUTPUT, params , stmt    [ ,bound param ][ ,...n ]]


Is the SQL Server generated handle identifier. handle is a required parameter with an int return value.


Identifies parameterized statements. The params definition of variables is substituted for parameter markers in the statement. params is a required parameter that calls for an ntext, nchar, or nvarchar input value. Input a NULL value if the statement is not parameterized.


Defines the cursor result set. The stmt parameter is required and calls for an ntext, nchar or nvarchar input value.


Signifies the use of additional parameters. bound_param is a required parameter that calls for input values of any data type to signify additional parameters for the procedure.


Must match the declarations made params. Can be in the form @name= value or value.

Community Additions

© 2015 Microsoft