- SQL code
今天学到 存储过程(主要是参数用法不明了)啦 请大家谈论下存储过程之秘籍啦
------解决方案--------------------
- SQL code
3、编写一个存储过程,包含一个输入参数, 指定阶乘最大值,包含一个输出参数,返回阶乘的值。create proc pro @n int,@sum int outputas declare @index int set @index=1 set @sum=1while(@index<[email protected]) begin set @[email protected][email protected] set @[email protected]+1 end declare @sum intexec pro 10,@sum outputselect @sum as 结果为4、编写一个存储过程,统计两个输入参数间能被整除 的整数个数及这些整数的和,两个输入参数,两个输 出参数。 create proc pron @n int,@m int,@sum int output,@total int outputasset @sum=0set @total=0while (@n<[email protected]) begin if @n%13=0 begin set @[email protected][email protected] set @[email protected]+1 set @[email protected]+1 end else set @[email protected]+1 enddeclare @sum int,@total int exec pron 5,1000,@sum output,@total outputselect @sum as 总和,@total as 总个数--贴上我上学期学存储过程时上机课做的课堂练习存储过程的参数分为两类:1 输入型,即input类型,input关键字可以省略2 输出型,即output类型,output关键字不可以省略但是存储过程可以不存在输入和输出参数,也可以只存在输入参数或者输出参数参数的字符类型可以为int,char 等等类型
------解决方案--------------------
【个人学习笔记17之--存储过程浅谈】
------解决方案--------------------
SQL 2005 存储过程的创建