Count the Occurrence of a Phrase or Word in a Column
Simple little bit of code that will show you the number of times the value of @PhraseOrWordToCount is found in TextColumn.
SELECT (LEN(TextColumn) - LEN(REPLACE(TextColumn,
@PhraseOrWordToCount, '')) / LEN(@PhraseOrWordToCount)) AS Occurrence
FROM dbo.MyTable
FROM dbo.MyTable
I noticed this on Simon Sabin's blog, I think it has more applications than just FullText searches so I thought I'd do a modified re-post.















