/****************************************************
FIBONACCI SERIES
*****************************************************/
DECLARE @i INT = 1, @o INT = 2
DECLARE @tbl TABLE(Num INT)
INSERT @tbl
SELECT 0
UNION ALL SELECT 1
UNION ALL SELECT 1
WHILE(@o<1000)
BEGIN
INSERT @tbl
SELECT @o
SET @o = @o + @i
SET @i = @o - @i
END
SELECT * FROM @tbl
GO
FIBONACCI SERIES
*****************************************************/
DECLARE @i INT = 1, @o INT = 2
DECLARE @tbl TABLE(Num INT)
INSERT @tbl
SELECT 0
UNION ALL SELECT 1
UNION ALL SELECT 1
WHILE(@o<1000)
BEGIN
INSERT @tbl
SELECT @o
SET @o = @o + @i
SET @i = @o - @i
END
SELECT * FROM @tbl
GO
No comments:
Post a Comment