任意连续整数之间的的乘积
代码
--任意连续整数之间的的乘积 修改 exce p_test ?,? 数值改变
-- author : 【DBA】小七
if Exists(Select name From sysobjects Where name='p_test' And type='P')
Drop Procedure p_test
Go
create proc p_test
@start_num int,
@end_num int
as
declare @cyc int
declare @size int
declare @count int
begin
set @cyc=1
set @size=(@end_num-@start_num)
set @count=@start_num
while @cyc<=@size
begin
set @start_num=@start_num+1
set @count=@count*@start_num
set @cyc=@cyc+1
end
select @count
END
go
EXEC p_test 1,5