How can I select rows based on a string containing ascii code 0x02?

I would like to find all rows in a table containing the character 0x02.
For clarity, I'm looking for something like:

SELECT * FROM table WHERE column LIKE '% 0x02%'
+3
source share
2 answers

Hexadecimal literals? A %-0x25

SELECT * FROM table WHERE column LIKE 0x250225

The validation guide reminds me that the syntax is 0xnot strictly an SQL standard, so maybe use insteadX''

SELECT * FROM table WHERE column LIKE X'250225'
+2
source

I would go with

SELECT * FROM table WHERE LOCATE(X'02', column) > 0
+3
source

All Articles