SQL server 谁能帮我写一个无参数有返回值的存储过程

来源:百度知道 编辑:UC知道 时间:2024/05/15 23:47:53
我刚学不久
刚才写了无参无返回值的,有参无返回值的,有参有返回值的
不知道怎么写有无参有返回值的
谢谢大家了

太钻牛角尖了,有参有返回的写过了,无参有返回还有什么特别的吗?
如果你是说在create 和as之间没有参数的声明才叫无参有返回值,那就是你没搞清楚状况了,返回值是和参数写在一起的,刚学的人可能会觉得和编程语言的方法里返回值和参数写在不同位置不一样不习惯?
随便看一个简单的存储过程,能看懂大概是什么意思,就可以了,这种东西用多了自然熟练了

create proc getJobInfo
@eid varchar(50),
@dname varchar(50) output,
@pname varchar(50) output,
@manager varchar(50) output,
@status varchar(50) output,
@joindate varchar(50) output

as
declare @parentid varchar(50)
select @parentid=b.parentid from employee a ,position b where a.eid=@eid and a.pid=b.pid

select @dname=dname from employee a,dept b where a.eid=@eid and a.did =b.did
--print @dname
select @pname =pname from employee a,position b where a.eid=@eid and a.pid=b.pid
--print @pname
select @manager=ename from employee where pid=@parentid
--print @manager
select @status =b.sttus_name from employee a,status b where eid=@eid and a.status=b.status_id
--print @status
select @joindate =joindate fr