How to count number of words in column using sql server | ASPMANTRA | Asp.Net,MVC,AngularJs,Jquery,Javascript,Sql Server AND WCF snippets and tutorial

How to count number of words in column using sql server

In this article I am going to explain how to count number of words in column using sql server.


Implementation:

I want to count the number of words in a column. Run the below given query to get total number of words: 

DECLARE @words VARCHAR(250)
SET @words = 'article mirror, asp.net, sql server'

SELECT LEN(@words) - LEN(REPLACE(@words, ' ', '')) + 1 as 'total number of words'

Result:

S.No.
Total number of words
1
5




Post a Comment

[blogger]

MKRdezign

Contact Form

Name

Email *

Message *

Powered by Blogger.
Javascript DisablePlease Enable Javascript To See All Widget