日期:2014-05-17  浏览次数:20696 次

存储过程A调用存储过程B中的值,并在A中输入问题
我有2个存储过程A和B,B调用A,在B中输出调用A的运算结果
Create proc A
as
begin
declare @ID int
set @ID=1--怎么把B中的@num的值,赋值给A中的ID@num的值
print @ID
end
-------------------------
Create proc B
as
begin
declare @num int
set @num=1
end

------解决方案--------------------
Create proc P_AA
as
begin
     declare @ID int
     EXEC P_BB @ID OUT 
     print @ID
end
GO
create  proc P_BB
   @re int out
as
begin
    set @re=600
    return 1
END
GO
exec P_AA

------解决方案--------------------


Create proc B(@id int output)
as
begin
declare @num int
set @num=1
set @id=@num
end 

GO

CREATE proc A
as
begin
declare @ID int
set @ID=999--怎么把B中的@num的值,赋值给A中的ID@num的值
exec dbo.b @id OUTPUT

print @ID
end
-------------------------
GO
 

exec dbo.A 
1