SDU Tools: Count Words in T-SQL

Some of the simpler tools that we've added to our free SDU Tools collection over the last year or so, have turned out to be quite useful.

A good example of this is CountWords.

This function takes a T-SQL string, removes the punctuation, excess whitespace, etc. and then counts the number of words contained. There are a few things that can still trick it (avoiding that would need very detailed langauge parsing) but it's quite good.

You can use it directly from our toolkit, or use the tool as an example of how to write the function in T-SQL.

You can see it in the image above, and you can see it in action here:

For more information on joining our insiders team to get all our free tools and resources, follow the link here:


Leave a Reply

Your email address will not be published. Required fields are marked *