* Tonino Greco
> Thanks - but I got it working :
> select * from table where col1 like concat("%", hex("somestring"), "%");
> the hex("somestring") - returns :736F6D65737472696E67

* me
>> hex("somestring") will always return 0, unless the string is
>> a numerical value

Sorry for that, this was changed in 4.0.1, hex("string") now returns a hex
representation of the string, like you said. In 3.23 it would only convert
numbers.

If col1 really contains hex strings, there is no need to use BLOB, because
hex strings are not binary, though they may _represent_ binary data. And, of
course, they take twice as much space to store, compared to the binary data.

Beware that you can get unpredictable results in some cases with the method
you describe above. For instance, if you search for the letter "B", it will
be executed as ... LIKE "%42%". If the actual data for a row is "D A", it
will be stored as "442041", and you will get a match for "%42%", even if it
does not contain the letter "B".

--
Roger
sql


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to