go
--查询是否存在
if(exists(select * from sys.objects where name='pro_testusergonghao'))
drop proc pro_testusergonghao
go
--包含输入变量 @gonghao,输入变量 @name output
create procedure pro_testusergonghao(@gonghao varchar(20),@name varchar(30) output)
as
declare @_gonghao varchar(20);
set @_gonghao=@gonghao
begin
select @name=name from usergonghao where gonghao=@_gonghao
end
declare @comename varchar(20)
--传入返回变量 @comename
exec pro_testusergonghao '001932',@comename output
select @comename as name