SQLize Online / PHPize Online  /  SQLtest Online

A A A
Share      Blog   Popular
Copy Format Clear
Create Procedure sp_Fibonacci(@max int) AS BEGIN Declare @numbers table(number int) Declare @n1 int = 0,@n2 int =1,@i int=0,@temp int Insert Into @numbers Values(@n1),(@n2) WHILE (@i < @max-2) BEGIN Insert Into @numbers Values(@n2+@n1) set @temp = @n2 Set @n2 = @n2 + @n1 Set @n1 = @temp Set @i += 1 END Select * from @numbers END GO DECLARE @f INT EXECUTE @f = sp_Fibonacci 10 SELECT @f GO

Stuck with a problem? Got Error? Ask ChatGPT!

Copy Clear