2009-08-26 12 views

答えて

4

sprocに出力パラメータがあると仮定します。これを呼び出して出力値を読み取ることができます。

CREATE PROCEDURE AddOne 
    @val int, 
    @valPlusOne int out 

AS 
BEGIN 
    SET NOCOUNT ON; 

    SET @valPlusOne = @val + 1 
END 
GO 

--This is used to store the output 
declare @PlusOne int 

--This calls the stored procedure setting the output parameter 
exec AddOne 1, @[email protected] OUT 

--This displays the value of the output param 
select @Plusone 
関連する問題