Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 counting number of a certain work in nvarchar(4000

Author  Topic 

pelegk2
Aged Yak Warrior

723 Posts

Posted - 2006-02-14 : 07:31:10
how cn i count how many time a word appears in nvarchar(4000) field?
thnaks in advance
peleg

Israel -the best place to live in aftr heaven 9but no one wan't to go there so fast -:)

jimmy_a
Starting Member

38 Posts

Posted - 2006-02-14 : 07:45:57
u can use split funtion to count the words

"A smile is an inexpensive way to improve your looks"
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-02-14 : 07:49:14
Not sure if this is feasible

Declare @col nvarchar(4000)
Declare @word varchar(100)
set @col='This is to test the test that test tested'
set @word='test'

select (len(@col)-len(replace(@col,@word,'')))/len(@word) as No_of_test

Alternatively, you can use your Front End application to split data and compare it with word

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -