Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to query MySQL for fields containing null characters

I have a MySQL table with a text column. Some rows have null characters (0x00) as part of this text column (along with other characters).

I am looking for a query that will return all rows containing any null characters for this column, but I cannot figure out how the proper syntax for my "where column like '%...%'" clause.

Thank you!

like image 640
CJS Avatar asked Jun 08 '13 00:06

CJS


1 Answers

Right after I submitted the question, a suggested link to this related question provided my answer: Query MySQL with unicode char code

WHERE column LIKE CONCAT("%", CHAR(0x00 using utf8), "%");

like image 160
CJS Avatar answered Oct 20 '22 11:10

CJS