create proc b @s varchar(100) output as select @s='cloudchen' godeclare @str varchar(100) exec b @s = @str output select @str godrop proc b
declare @a intexec test @a outputselect @a 结果
--存储过程有两种返回值的情况,看你的存储过程是怎么样写的.--第一种 create proc p1 as return(4) go--第二种 create proc p2 @re int output as set @re=4 go --调用方法 declare @re int--调用第一个的方法 exec @re=p1--调用第二个的方法 exec p2 @re out
exec @a = test
select @int
??
declare @a int
exec @a = test
select @a
@s varchar(100) output
as
select @s='cloudchen'
godeclare @str varchar(100)
exec b @s = @str output
select @str
godrop proc b
create proc p1
as
return(4)
go--第二种
create proc p2
@re int output
as
set @re=4
go
--调用方法
declare @re int--调用第一个的方法
exec @re=p1--调用第二个的方法
exec p2 @re out