SQL存储过程返回值
来源:互联网 发布:带帽子女孩网络歌手 编辑:程序博客网 时间:2024/05/16 10:17
先靠一下自己。
当我做多了ORACLE时,我就忘了SQL的储存过程可以返回数据集这个事实了。
。。。。。。。。。。。。。。。。
Create procedure test
@t1 int,
@t2 nvarchar(200) out
as
set t2='这个是输出参数';
go
调用
declare @out_t2 nvarchar(200);
exec test 1,@out_t2;
select @out_t2;
输出:
这个是输出参数
------
也可以定义一个接收参数,接收存储过程的成功与否的默认返回值(这会是一个整数,0 是无错误执行,其它数为错误代码!)
declare @val int;
declare @out_t2 nvarchar(200);
exec @val = test 1,@out_t2;
select @out_t2,@val;
除了这些简单参数,存储过程还可以直接返回一个数据集
create table table_2( i_key int,i_value varchar(20));
declare @d int;
set @d=1;
WHILE @d<10
begin
insert into table_2 select @d+1,cast(@d as varchar(50))+'S';
set @d = @d+1;
end;
Create procedure test
@t1 int
as
select * from table_2;
go
执行:
exec test 1;
结果,就是table_2表的集合.
- sql 存储过程返回值
- sql 存储过程返回值
- SQL存储过程返回值
- SQL存储过程返回值
- SQL的存储过程实例返回值
- SQL Server存储过程返回值
- SQL Server存储过程的返回值
- 探讨SQL SERVER存储过程返回值
- SQL存储过程读取另一存储过程返回值(select返回)变通方法
- 存储过程返回值
- 存储过程返回值
- 存储过程 返回值
- 存储过程-返回值
- 存储过程返回值
- 获得SQL-server存储过程的返回值
- sql server 2000存储过程返回值的总结
- mysql存储过程在动态SQL内获取返回值
- sql server 2000存储过程的返回值
- mysql replication 主从复制实现性能扩展
- JavaScript方法call,apply,caller,callee,bind的使用详解及区别
- Struts2+Spring3+Hibernate3整合
- android:persistent属性
- 什么是计算机语言
- SQL存储过程返回值
- Memcached drive_machine 函数分析_process_update_command
- MongoDB简单的增删改
- FlashBuilder(Flex4) 调试无法调试问题 找不到所需Adobe Flash Player调试版本
- WizISP Flash Programmer 是什么?
- nova.conf 参数说明
- C++类中定义常量
- C++string类的c_str()函数
- C++学习笔记(9)----异常处理