להלן ה פתרון ב sql server 2000
תגדיר פונקציה create function dbo.fn_max (@a decimal (10,2), @b decimal (10,2)) returns decimal (10,2) as begin declare @x decimal (10,2) if @a > @b set @x = @a else set @x = @b return @x end go select dbo.fn_max(@a,dbo.fn_max(@b,dbo.fn_max(@c,@d))) will give you the answer