sql标量函数
USE [CMS]
GO
/****** Object: UserDefinedFunction [dbo].[concat] Script Date: 2021/10/18 13:37:59 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE FUNCTION [dbo].[concat]
(
@REF_1 varchar(max),
@REF_2 varchar(max)
)
RETURNS VARCHAR(MAX)
AS
BEGIN
DECLARE @REF_1_DO VARCHAR(max);
DECLARE @REF_2_DO VARCHAR(max);
IF @REF_1 IS NULL
BEGIN
SET @REF_1_DO = ''
END
ELSE
BEGIN
SET @REF_1_DO =@REF_1
END
IF @REF_2 IS NULL
BEGIN
SET @REF_2_DO = ''
END
ELSE
BEGIN
SET @REF_2_DO =@REF_2
END
RETURN @REF_1_DO+@REF_2_DO
END
GO