
I had to query a customer table which has customer name enclosed in square brackets.
I tried this first
SELECT * FROM JCustomer WHERE FirstName LIKE '%[%]' -- no rows returned
SELECT * FROM JCustomer WHERE FirstName LIKE '%[%]' -- no rows returned
Then i tried this,
SELECT * FROM JCustomer WHERE FirstName LIKE ' [ [ ]% ' -- this return records which start with square brackets. The trick is to enclose the search string within a square bracket.
SELECT * FROM JCustomer WHERE FirstName LIKE ' [ [ ]% ' -- this return records which start with square brackets. The trick is to enclose the search string within a square bracket.