--累加求和存储过程 alter proc LeiJiaQiuHe1 @num int--输入参数 as declare @sum int declare @i int set @sum=0 set @i=1 while @i<=@num begin set @sum=@sum+@i set @i=@i+1 end return @sum go declare @jieshou int exec @jieshou=LeiJiaQiuHe1 100 print @jieshou
--累加求和存储过程 alter proc LeiJiaQiuHe1 @num int--输入参数 as declare @sum int declare @i int set @sum=0 set @i=1 while @i<=@num begin set @sum=@sum+@i set @i=@i+1 end return @sum go declare @jieshou int exec @jieshou=LeiJiaQiuHe1 100 print @jieshou