使用sql语句创建带有输出参数的存储过程

一:下面介绍带有输出参数和返回值的存储过程的创建方法

1,创建存储过程

create proc p5 @cno char(10),@ccredit decimal (5,1) output

as

begin

if exist (select * from course where c_no=@cno)

update course

set c_credit=c_credit+1

where c_no=@cno

select ccredit=c_credit from course

where c_no=@cno

print @cno+'课程的分数为:'+@convert(varchar(10),@ccredit)         

end

2,执行存储过程

declare  @cno char(10),@ccredit decimal (5,1) output

set @cno='c03'

exec p5 @cno,@ccredit output

原文地址:https://www.cnblogs.com/cat-123-ofmine/p/5058051.html