Search code examples
sqlazure-synapse

Synapse Analytics - How to find square bracket in text


Hi i want to find campaign that contain text with the square bracket as part of the text.

ESCAPE doesn't seem to work on Synapse Analytics

WHERE campaign LIKE '%[de]%' OR campaign LIKE '%[be]%'

Solution

  • You can try following queries in synapse to get text with square brackets

    WHERE campaign LIKE '%[de]%'  OR campaign LIKE '%[be]%'
    

    Or

    Using extra brackets

    WHERE campaign LIKE '%[[]de]%'  OR campaign LIKE '%[[]be]%'
    

    My sample data:

    enter image description here

    Output

    enter image description here

    enter image description here