标签:ar sql c har server print select on
--利用sqlserver来运算斐波那契规律
declare @number int
declare @A int
declare @B int
declare @C int
set @A=1
set @B=2
set @Number=3
select @C=@A+@B
while(@Number<60)
begin
set @C=@A+@B
if(@@ERROR<>0)
goto errorhandler
print N‘第‘+convert(varchar(20), @number)+N‘个数为‘+convert(varchar(20), @C)
set @A=@B
set @B=@C
set @Number=@Number+1
end
errorhandler:
print N‘第‘+convert(varchar(20), @number)+N‘个数计算溢出‘
在sqlserver中做fibonacci(斐波那契)规律运算,布布扣,bubuko.com
在sqlserver中做fibonacci(斐波那契)规律运算
标签:ar sql c har server print select on
原文地址:http://www.cnblogs.com/gold-miss/p/3890948.html