MySQL Case Sensitivity with BINARY VALUES

I have some binary data that i want to convert to lower or upper case to compare to a string.

SELECT myBinaryData FROM table_a WHERE myBinaryData Like "UPPERCASE";

The string in the where clause will be mixed case as will the binary data, i would like to know if it is possible to convert them both to either lower or uppercase to make the comparison.

LCASE() or UPPER() does not seem to work with binary data values, is there any other solution to this? (No points for telling me to change my data type to non binary)
phipstaAsked:
Who is Participating?
 
Rob SiklosCommented:
See the use of the CONVERT function: http://dev.mysql.com/doc/refman/5.0/en/cast-functions.html

maybe you can do something like:

SELECT myBinaryData FROM table_a WHERE UPPER(CAST(myBinaryData AS CHAR)) LIKE "UPPERCASE";
0
 
phipstaAuthor Commented:
Your example given works like a dream. In fact you now don't need to convert the column to upper case as now both and treated like CHAr data types and the LIKE statement is not case sensitive.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.