In a CASE expression, I'm trying to search inside a text column to identify a hyphen (-):
CASE
WHEN SUBSTRING(al.ALT_ADDRESS,1,1) IN('1','5','7')
AND al.NEW_ADDRESS CONTAINS '-'
THEN CONCAT(al.ALT_ADDRESS,al.NEW_ADDRESS)
The hyphen can be located anywhere in the column, and so I just need to know if it exists, regardless of where it actually is in the column.
I'm currently using the exact same code that @Josh provided (LIKE '%-%'), but it doesn't work, because it doesn't return the correct data for several specific instances where I know that it "should" be. The exact text in ALT_ADDRESS is: "2754 Churchill Circle". The exact text in NEW_ADDRESS is: "O-89421". However, the results that are returned, does not include the NEW_ADDRESS (O-89421).
I have confirmed that dash in NEW_ADDRESS really matches the dash I'm using the search (ASCII 45).