Login or Sign Up
Logging in...
Remember me
Log in
Or
Sign Up
Forgot password or user name?
Log in with
Search in titles only
Search in .NET only
Search
Advanced Search
Forums
BYTES
Product Launch
Updates
Developer Toolkit
Today's Posts
Member List
Calendar
Home
Forum
Topic
.NET
Count Particular Word In String in Sql Server 2000
Collapse
X
Collapse
Posts
Latest Activity
Photos
Page
of
1
Filter
Time
All Time
Today
Last Week
Last Month
Show
All
Discussions only
Photos only
Videos only
Links only
Polls only
Events only
Filtered by:
Clear All
new posts
Previous
template
Next
kushal49
New Member
Join Date:
Feb 2008
Posts:
10
#1
Count Particular Word In String in Sql Server 2000
Feb 13 '08, 10:51 AM
Hi,
I need to count a particular word in a string in sql server 2000.
Anybody please help me out in this...
r035198x
MVP
Join Date:
Sep 2006
Posts:
13225
#2
Feb 13 '08, 11:08 AM
Originally posted by
kushal49
Hi,
I need to count a particular word in a string in sql server 2000.
Anybody please help me out in this...
Do you mean count the frequency of a particular word in a string?
What does sql server have to do with it?
Comment
Post
Cancel
Sameerlucky
New Member
Join Date:
Feb 2008
Posts:
6
#3
Feb 13 '08, 02:49 PM
Hi,
Refer below example..
while @idx <= len (@sourceStr)
begin
set @currOccurence = CharIndex (@subStr,@sourc eStr,@idx)
if (@currOccurence > 0)
begin
set @res = @res + 1
set @idx = @currOccurence
end
else
set @idx = len(@sourceStr)
set @idx = @idx + 1
end
return @res
end
Cheers,
Sameer
Comment
Post
Cancel
kushal49
New Member
Join Date:
Feb 2008
Posts:
10
#4
Feb 14 '08, 06:42 AM
Thanks Sameer!!!
Your code solved my problem...
Comment
Post
Cancel
Previous
template
Next
Working...
Yes
No
OK
OK
Cancel
👍
👎
☕
Comment