2009-08-26 202 views

回答

4

假设您有一个带有输出参数的存储区。您可以调用它并读取输出值。

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