CREATE FUNCTION dbo.Split_On_Upper_Case
(
@String VARCHAR(4000)
)
RETURNS VARCHAR(4000)
AS
BEGIN
DECLARE @Char CHAR(1);
DECLARE @i INT = 0;
DECLARE @OutString VARCHAR(4000) = '';
WHILE (@i <= LEN(@String))
BEGIN
SELECT @Char = SUBSTRING(@String, @i,1)
IF (@Char = UPPER(@Char) Collate Latin1_General_CS_AI)
SET @OutString = @OutString + ' ' + @Char;
ELSE
SET @OutString = @OutString + @Char;
SET @i += 1;
END
SET @OutString = LTRIM(@OutString);
RETURN @OutString;
END
Comments
Post a Comment