Robert Myers <rob.my...@ziften.com> wrote:
> On 6/5/2011 8:47 AM, Igor Tandetnik wrote:
>> iip <iip.umar.ri...@gmail.com> wrote:
>>> As subject, I want to know how search column that contain ascii chr(0)
>> select * from MyTable where hex(MyField) like '%00%';
> 
> That query doesn't work. If the field contains 0\n, that would match (300A)

True. Another attempt:

select * from MyTable where 2*length(MyField) != length(hex(MyField));

This relies on the fact that built-in function length() seems to stop 
(erroneously, in my opinion) on the first embedded NUL, while hex() doesn't 
seem to mind them. At least that's what happens with my copy of SQLite 3.7.2.

Beyond this nasty hack, I can't think of anything short of writing a custom 
function. I tried LIKE and replace() - they don't work with embedded NULs 
either.
-- 
Igor Tandetnik

_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to