sql | SQL Server‎ > ‎sqlsrv | T-SQL‎ > ‎

tsql | sp_prepare

declare @P1 int

 

exec sp_prepare @P1 output, null, N'select 123', 1

select @P1

 

exec sp_execute @p1





--create proc t @y int out as set @y = 1

declare @P1 int, @oo int
 
 --EXEC T @OO OUT
 --SELECT @OO

exec sp_prepare @P1 output, N'@u int OUT', N'exec t @u out', 1

select @P1 

exec sp_execute @p1, @oo OUT 

select @oo
Comments