Skip to content

Latest commit

 

History

History
65 lines (54 loc) · 2.14 KB

File metadata and controls

65 lines (54 loc) · 2.14 KB
title sp_unprepare (Transact-SQL) | Microsoft Docs
ms.custom
ms.date 03/06/2017
ms.prod sql
ms.prod_service database-engine, sql-data-warehouse, pdw
ms.reviewer
ms.technology system-objects
ms.topic language-reference
f1_keywords
sp_cursor_unprepare_TSQL
sp_cursor_unprepare
dev_langs
TSQL
helpviewer_keywords
sp_unprepare
ms.assetid 14320251-c551-49d8-b933-057406114978
author stevestein
ms.author sstein
monikerRange >=aps-pdw-2016||=azure-sqldw-latest||>=sql-server-2016||=sqlallproducts-allversions||>=sql-server-linux-2017||=azuresqldb-mi-current

sp_unprepare (Transact-SQL)

[!INCLUDEtsql-appliesto-ss2008-xxxx-asdw-pdw-md]

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

-- Syntax for SQL Server, Azure SQL Data Warehouse, Parallel Data Warehouse  
  
sp_unprepare handle           

Arguments

handle
Is the handle value returned by sp_prepare.

Examples

The following example prepares, executes, and unprepares a simple statement.

DECLARE @P1 int;  
EXEC 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';  
EXEC sp_execute @P1, N'tempdb', N'ONLINE';  
EXEC sp_unprepare @P1;  

Examples: [!INCLUDEssSDWfull] and [!INCLUDEssPDW]

The following example prepares, executes, and unprepares a simple statement.

DECLARE @P1 int;  
EXEC 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';  
EXEC sp_execute @P1, N'tempdb', N'ONLINE';  
EXEC sp_unprepare @P1;  

See Also

sp_prepare (Transact SQL)