create function dbo.fnConcat ( @a varchar(max) ,@delim varchar(max) ,@b varchar(max) ) returns varchar(max) as begin declare @result varchar(max) ,@aLen int ,@bLen int select @a = RTRIM(ltrim(coalesce(@a,''))) ,@aLen = LEN(@a) ,@b = RTRIM(ltrim(coalesce(@b,''))) ,@bLen = LEN(@b) select @result = case when @aLen > 0 and @bLen > 0 then @a + @delim + @b when @aLen > 0 then @a when @bLen > 0 then @b else '' end return @result end
ScrewTurn Wiki version 3.0.1.400. Some of the icons created by FamFamFam. Except where noted, all contents Copyright © 1999-2024, Patrick Jasinski.