存储过程嵌套调用,获取上一层存储过程的输出值

来源:互联网 发布:linux下安装qt5 编辑:程序博客网 时间:2024/04/29 23:49

近期的项目因为涉及到存储过程嵌套调用,所以做了一个获取上一层存储过程的输出值的测试



alter proc test1
 @id int
 ,@outP int output
 ,@outMsg varchar(200) output
as
begin
-- select @id
 set @outP=@outP+@id
 set @outMsg='输出消息'
-- select @outP
end
go

alter proc test2
 @id int
as
begin
 declare @rt int
 ,@outMsg varchar(200)
 set @rt=3
 exec test1 @id,@rt,@outMsg OUTPUT
 select @rt,@outMsg
end
go

exec test2 1
go

原创粉丝点击