MySQL Case Sensitivity with BINARY VALUES

Posted on 2009-02-18
Last Modified: 2012-05-06
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)
Question by:phipsta
    LVL 9

    Accepted Solution

    See the use of the CONVERT function:

    maybe you can do something like:

    SELECT myBinaryData FROM table_a WHERE UPPER(CAST(myBinaryData AS CHAR)) LIKE "UPPERCASE";

    Author Comment

    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.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    What Should I Do With This Threat Intelligence?

    Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

    More Fun with XML and MySQL – Parsing Delimited String with a Single SQL Statement Are you ready for another of my SQL tidbits?  Hopefully so, as in this adventure, I will be covering a topic that comes up a lot which is parsing a comma (or other…
    All XML, All the Time; More Fun MySQL Tidbits – Dynamically Generate XML via Stored Procedure in MySQL Extensible Markup Language (XML) and database systems, a marriage we are seeing more and more of.  So the topics of parsing and manipulating XM…
    This video discusses moving either the default database or any database to a new volume.
    Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

    794 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now