I need to create function that will find a lesser of two values. It should receive either INT or TIME type arguments. Something of this structure:
CREATE FUNCTION fn_Min(@p_1 (time or int), @p_2 (time or int))
RETURNS time
AS
BEGIN
DECLARE @lesser (time or int)
IF @p_1 <= @p_2
SET @lesser = @p_1
ELSE
SET @lesser = @p_2
RETURN @lesser
END
Is it possible?