T-SQL Tutorial

T-SQL Sp_unprepare

On Transact SQL language the sp_unprepare is part of Database Engine Stored Procedures and discards the execution statement created by the sp_prepare stored procedure.

Sp_unprepare syntax:

sp_unprepare handle ;

Sp_unprepare example:

USE model;
DECLARE @Param1 int;
EXEC sp_prepare @Param1 output,
N'@Param1 nvarchar(100), @Param2 nvarchar(100)',
N'SELECT database_id, name FROM sys.databases
WHERE name=@Param1 AND state_desc = @Param2';
EXEC sp_execute @Param1, N'myDatabase', N'ONLINE';
EXEC sp_unprepare @Param1;