-
Word count
Hi,
I was hoping somone could help. I need to count the number of words in a specfic column in a table if i didn't know what the words said.
I can count the number of words using
DECLARE @String VARCHAR(4000)
SET @String = ' words to be counted'
SELECT LEN(@String) - LEN(REPLACE(@String, ' ', '')) + 1
AS Results
but this requires me to know what the words are and not count them from the column.
-
I don't understand the problem. Are you asking how to use your SQL statement for a column in a table? Like this?
SELECT LEN(YourColumn) - LEN(REPLACE(YourColumn, ' ', '')) + 1
AS Results
FROM YourTable
-
Hi,
Sorry i was having a brain fart at the time. managed to get it all sorted.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|