存储过程嵌套调用,获取上一层存储过程的输出值
2011-01-15 11:33
246 查看
近期的项目因为涉及到存储过程嵌套调用,所以做了一个获取上一层存储过程的输出值的测试
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
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
相关文章推荐
- MySQL存储过程例子,包含事务,输出参数,嵌套调用,游标,循环等等
- 关于调用存储过程获取参数返回值和输出参数注意的问题
- MySQL存储过程例子,包含事务,输出参数,嵌套调用
- 关于sqlhelper调用存储过程获取参数返回值和输出参数的问题
- MySQL存储过程例子(包含事务,输出参数,嵌套调用)
- asp程序调用SQL Server的存储过程,获取不到输出参数的值
- 存储过程有输出参数,在c#中用nhibernate调用存储过程时,如何才能获取到一个结果集和这个输出参数呢?
- MySQL存储过程例子(包含事务,输出参数,嵌套调用)
- asp程序调用SQL Server的存储过程,获取不到输出参数的值
- [译]DbContext API中使用SqlQuery和ExecuteSqlCommand获取存储过程的输入输出参数
- jdbc调用存储过程获取多个结果集
- SqlParameter设定的value值为0时、调用的存储过程获取到的值却为null解决方法
- C#获取存储过程的 Return返回值和Output输出参数值
- JDBC调用带输出参数的存储过程
- EF 中调用带输出参数的存储过程
- mybatis mysql 关于调用存储过程获取查询结果
- C#获取存储过程的Return返回值和Output输出参数值
- C#中如何获取存储过程的输出参数值
- Java代码调用数据库带输出参数的存储过程
- MySQL存储过程例子,包含事务,参数,嵌套调用,游标,循环等