View Thread
 Print Thread
Function to split UpperCaseStrings like this into seperate words
admin
Bloody usefull function robbed from tek-tips.com.

Will change JoinedUpperCaseWordsLikeThis to Joined Upper Case Words Like This



CREATE FUNCTION dbo.SpaceUpper
    (
      @Original VARCHAR(8000)
    )
RETURNS VARCHAR(8000)
AS
    BEGIN 
        WHILE PATINDEX('%[^ ][A-Z]%', @Original COLLATE Latin1_General_Bin) > 0
            SET @Original = REPLACE(@Original COLLATE Latin1_General_Bin, SUBSTRING(@Original, 1 + PATINDEX('%[^ ][A-Z]%', @Original COLLATE Latin1_General_Bin), 1), ' ' + SUBSTRING(@Original, 1 + PATINDEX('%[^ ][A-Z]%', @Original COLLATE Latin1_General_Bin), 1)) 
        RETURN LTRIM(@Original)
    END

Jordon Pilling | Heavencore Administrator
 
Jump to Forum