Nóta
Teastaíonn údarú chun rochtain a fháil ar an leathanach seo. Is féidir leat triail a bhaint as shíniú isteach nó eolairí a athrú.
Teastaíonn údarú chun rochtain a fháil ar an leathanach seo. Is féidir leat triail a bhaint as eolairí a athrú.
Applies to:
SQL Server
Azure SQL Managed Instance
Azure Synapse Analytics
Analytics Platform System (PDW)
Discards the execution plan created by the sp_prepare
stored procedure. sp_unprepare
is invoked by specifying ID = 15
in a tabular data stream (TDS) packet.
Syntax
sp_unprepare handle
[ ; ]
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
. handle is int.
Examples
The following example prepares, executes, and unprepares a basic statement.
DECLARE @P1 AS INT;
EXECUTE sp_prepare
@P1 OUTPUT, N'@P1 NVARCHAR(128), @P2 NVARCHAR(100)',
N'SELECT database_id, name FROM sys.databases WHERE name = @P1 AND state_desc = @P2';
EXECUTE sp_execute @P1, N'tempdb', N'ONLINE';
EXECUTE sp_unprepare @P1;