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 the occurrences of a string in a text or ntext field?

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2001-05-13 : 23:55:32
Jon writes "How do you count the occurrences (frequency) of a string in a text or ntext field (my values are > 8000 characters)? I know that with char fields, something like:
SELECT ( LEN( [TextField]) - LEN( REPLACE( [TextField] , 'string' , '' ) ) ) / LEN( 'string' )
will work. Unfortunately, casting text to char or varchar won't work in my case. Is there anything to do?
Thanks,
Jon Cooper"
   

- Advertisement -