/* 최대값을 구하는 함수 */
CREATE FUNCTION FN_GREATEST (@pVALUE1 NVARCHAR(255), @pVALUE2 NVARCHAR(255))
RETURNS NVARCHAR(255)
AS
BEGIN
DECLARE @sRTN NVARCHAR(255)
SET @sRTN = ''
IF LTRIM(RTRIM(@pVALUE1)) >= LTRIM(RTRIM(@pVALUE2))
BEGIN
SET @sRTN = @pVALUE1
END ELSE
BEGIN
SET @sRTN = @pVALUE2
END
RETURN (@sRTN)
END
/* 최소값을 구하는 함수 */
CREATE FUNCTION FN_LEAST (@pVALUE1 VARCHAR(255), @pVALUE2 VARCHAR(255))
RETURNS varchar(255)
AS
BEGIN
DECLARE @sRTN varchar(255)
SET @sRTN = ''
IF LTRIM(RTRIM(@pVALUE1)) <= LTRIM(RTRIM(@pVALUE2))
BEGIN
SET @sRTN = @pVALUE1
END ELSE
BEGIN
SET @sRTN = @pVALUE2
END
RETURN (@sRTN)
END
RECENT COMMENT