wetmatter nonsense

let's get random 
« Back to blog

UPDATED - SQL: Parsename Replace RTRIM LTRIM

Attached in the [DOWNLOAD SECTION] is a script titled "FourPartStringParse_v0.01.sql" that will parse out an address. It has limitations though. See the file comments for details. Thanks to @MarlonRibunal for the help!

I tried this route, but the problem with this script is that it counts every space.  So if there happens to be a double space between two words then it gets added to the total count.  

DECLARE @String NVARCHAR(100)
SET @String = 'How many words are  there in this big string?'
SELECT @String,(1 + LEN(@String) - LEN(REPLACE(@String, ' ', ''))) AS WordCount  as you can see in the illustration below.

The following method worked better, but I still had some issues with it as I mentioned before.

Click here to download:
FourPartStringParse_v0.01.sql (0 Bytes)

Screenshot

Posted by Samson Loo 

Comments (0)

Leave a comment...