带Return和Output参数的存储过程

同时带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

posted on 2022-09-11 16:22  洞幺人生  阅读(24)  评论(0编辑  收藏  举报