views:

59

answers:

1

Is there a way to count words in a text string? I'm using SQL lite 3 and I'm trying to write a query that takes a bunch of long strings of text, and counts the number of words in each one.

I also want to ignore html tags (or anything between carats) such as paragraph tags, break tags, etc.

So when I run a query selecting text from the appropriate column, I get a large wordy text output with some html tags in it, and I just want to count the words.

Any help is appreciated, thanks!

A: 

As far as I know there is no way to directly count the number of words in a string in SQL lite 3. (I'm more familiar with mysql and ms sql)

You can use Length and Replace as a work around

 SELECT length(@String) - length(replace(@String, ' ', '')) + 1
b8b8j