SQL Server存储过程Return、output参数及使用技巧
来源:互联网 发布:pon网络组网方式 编辑:程序博客网 时间:2024/05/17 06:48
1、不带输入参数的简单存储过程
if object_id('up_user') is not null
drop proc up_user
go
create proc up_user
as
set nocount on
delcare @name varchar(10)
begin
select @name=uname from user
end
set nocount off
go
esec up_user
2、带输入参数的简单存储过程
if object_id('up_user') is not null
drop proc up_user
go
create proc up_user
@id int
as
set nocount on
delcare @name varchar(10)
begin
select @name=uname from user where uid=@id
end
set nocount off
go
--执行该存储过程
esec up_user 1
3、带Return参数的存储过程
if object_id('up_user') is not null
drop proc up_user
go
create proc up_user
as
set nocount on
delcare @age int
begin
select @age=uage from user
return @age
end
set nocount off
go
--执行该存储过程
declare @age int
exec @age=up_user
select @age
4、带output参数的存储过程
if object_id('up_user') is not null
drop proc up_user
go
create proc up_user
@id int,
@name varchar(10) ='' output
as
set nocount on
begin
select @name=uname from user where uid=@id
end
set nocount off
go
--执行该存储过程
declare @name varchar(10)
exec up_user 2, @name output
select @name
5、同时带Return和output参数的存储过程
if exists(select name from sysobjects where name='up_user' and type='p')
drop proc up_user
go
create proc up_user
@id int,
@name varchar(20) output
as
declare @age int
begin
select @age=stuage,@name=stuname from stuinfo where uid=@id
return @age
end
--执行该存储过程
declare @age int
declare @name varchar(20)
exec @age=up_user 2,@name output
select @age,@name
- SQL Server存储过程Return、output参数及使用技巧
- SQL Server存储过程Return、output参数及使用技巧
- SQL Server存储过程Return、output参数及使用技巧
- SQL Server存储过程Return、output参数及使用技巧
- Sql Server 存储过程 output
- ASP中调用存储过程、语法、写法-sql server数据库,return,output
- 存储过程的output及return的区别
- 如何使用存储过程output参数
- .net 中如何使用存储过程output和return值
- 存储过程中的out,output,return 的使用
- Cpp 调用sql server 存储过程时不返回output参数解决办法
- MyBatis调用存储过程,含有返回结果集、return参数和output参数
- MyBatis调用存储过程,含有返回结果集、return参数和output参数 .
- MyBatis调用存储过程,含有返回结果集、return参数和output参数
- MyBatis调用存储过程,含有返回结果集、return参数和output参数
- MyBatis调用存储过程,含有返回结果集、return参数和output参数
- MyBatis调用存储过程,含有返回结果集、return参数和output参数
- MyBatis调用存储过程,含有返回结果集、return参数和output参数
- PRIMARY KEY主键和IDENTITY属性函数的区别
- unix内核概述-同步和临界区
- 软考——算法及常用排序算法总结
- 今年夏天有种病,重新定义了流行。
- 常用排序及其时间复杂度
- SQL Server存储过程Return、output参数及使用技巧
- Linux网卡驱动程序编写
- MFC自绘控件学习总结第二贴
- 练习maya python API jointChain中文标注
- sqlserver SET....ON命令
- Android--App缓存管理
- starting of process of android
- WCF开发框架形成之旅---WCF的几种寄宿方式 (转帖)
- 如何设置通过PMU的gpio来唤醒系统