CREATE FUNCTION FUN(@num int) returns int as begin if(@num<=2) return 1 return [dbo].[FUN](@num-1)+[dbo].[FUN](@num-2) end go SELECT [dbo].[FUN] (1) [1], [dbo].[FUN] (2) [2], [dbo].[FUN] (3) [3], [dbo].[FUN] (4) [4], [dbo].[FUN] (5) [5], [dbo].[FUN] (6) [6], [dbo].[FUN] (7) [7], [dbo].[FUN] (8) [8], [dbo].[FUN] (9) [9], [dbo].[FUN] (10) [10], [dbo].[FUN] (11) [11]