lowest function

— =============================================
— Author:  Bas van den Berg
— Create date: 2013-02-19
— Description: return the lowest of two numbers
— =============================================
ALTER FUNCTION [dbo].[lowest](@a Decimal(10,2) , @b Decimal(10,2) )
RETURNS Decimal(10,2)
AS
BEGIN
declare @result as Decimal(10,2)

if  (@a <= @b and not @a is null) or @b is null
set @result = @a
ELSE
set @result = @b

return @result
END

Leave a Reply

Your email address will not be published. Required fields are marked *