I have a table A with a column named OriginalWord and a table B with a column name mySentence.
OriginalWord has rows like:
- star
- data
- checking
which stores any single word.
mySentence stores rows with sentences for example: This is a star.
I would like to list all the rows in mySentence if any of the words in OriginalWord exists in mySentence.
So mySentence in the above example would be listed but not if the row of mySentence is “This is my dad.”
How do I write that in T-SQL?
Because of
LIKE %%predicate get rid of index usage you can use this to achieve what you want.UPDATE
SQL FIDDLE DEMO