I\'ve a string, @mainString = \'CATCH ME IF YOU CAN\'
. I want to check whether the word ME
is inside @mainString
.
How do I che
You can just use wildcards in the predicate (after IF, WHERE or ON):
@mainstring LIKE '%' + @substring + '%'
or in this specific case
' ' + @mainstring + ' ' LIKE '% ME[., ]%'
(Put the spaces in the quoted string if you're looking for the whole word, or leave them out if ME can be part of a bigger word).