How to search for a list of words contains in a string column?
To search whether the list of words contains in a column, you can implement it using a series of conditions with LIKE
and OR
operators. But to search for additional word, you need to add another condition.
Instead of the above approach, you can create the below function dbo.fn_contains
that search for the words in a string column. This function uses another function dbo.fn_string_to_list
which converts a string to a list of values.
Sample query to search for a list of words in a string column.