if (exists(select * from sys.objects where name='GetUser'))
drop proc GetUser
go
create proc GetUser
@id int output,
@name varchar(20) out
as
begin
select @id=Id,@name=Name from UserInfo where Id=@id
end
go
declare
@name varchar(20),
@id int;
set @id=3;
exec dbo.GetUser @id,@name out;
select @id,@name;
print Cast(@id as varchar(10))+'-'+@name;
参数output为该参数可以输出