SQL Server union selects built dynamically from list of words
- by Adam Tuttle
I need to count occurrence of a list of words across all records in a given table. If I only had 1 word, I could do this:
select count(id) as NumRecs where essay like '%word%'
But my list could be hundreds or thousands of words, and I don't want to create hundreds or thousands of sql requests serially; that seems silly. I had a thought that I…