In Excel, there's a function called "MAX" that accepts numbers and returns the largest one in the set. Is there a function in T-SQL that duplicates this functionality? I haven't been able to find one, and I've written a UDF that does it for me, but I thought it was worth asking.
Here is the function I've been using:
CREATE FUNCTION dbo.LargerOf
(
-- Add the parameters for the function here
@First FLOAT,
@Second FLOAT
)
RETURNS FLOAT
AS
BEGIN
DECLARE @Result FLOAT
IF @First > @Second
SET @result = @First
ELSE
SET @Result = @Second
RETURN @Result
END
GO
I don't expect any luck, but instead of moving my function to a whole bunch of new servers, I thought I'd at least ask. Thanks!