Skip to content
Advertisement

Get Word Count of a Column using SQL

I have a table with a column called Description. The column is populated with text data. I want to create a query that returns the amount of words in each description.

My thought was to create a function that takes in a value, and returns the amount of words found in the inputted text.

For example, if the description is “Hello World! Have a nice day.”, the query should return 6.

How can I get the word count of the description column?

Advertisement

Answer

See this proposed solution: http://www.sql-server-helper.com/functions/count-words.aspx

Usage Example:

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement