I want to compare a string to see if it contains a substring, however, when I use a variable it evaluates to true when it should be false.
Any idea why this is happening and how to fix this?
DECLARE @Match VARCHAR
SET @Match = '%Matching%'
SELECT CASE WHEN 'Does This Match' LIKE @Match THEN 1 ELSE 0 END -- 1
SELECT CASE WHEN 'Does This Match' LIKE '%Matching%' THEN 1 ELSE 0 END -- 0