clear markdown compare help best fiddles feedback dbanow.uk a leap of faith?
clear markdown donate comments/suggestions/bugs a leap of faith? bible365 diddy dollings
By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0. 921333 fiddles created (11964 in the last week).

CREATE FUNCTION dbo.test5(@i int) RETURNS INT AS BEGIN RETURN( SELECT TOP 1 CASE WHEN @i = 1 THEN 1 WHEN @i = 2 THEN 2 WHEN @i = 3 THEN dbo.test5(1) + dbo.test5(2) END ) END;
 hidden batch(es)


CREATE FUNCTION dbo.test6(@i int) RETURNS INT AS BEGIN RETURN( SELECT TOP 1 CASE WHEN @i = 1 THEN 1 WHEN @i = 2 THEN 2 WHEN @i = 3 THEN (SELECT dbo.test6(1) + dbo.test6(2)) END )END;
 hidden batch(es)


SELECT dbo.test5(3);
(No column name)
3
 hidden batch(es)


SELECT dbo.test6(2);
Msg 217 Level 16 State 1 Line 1 Maximum stored procedure, function, trigger, or view nesting level exceeded (limit 32).
 hidden batch(es)