?
Solved

MySQL Case Sensitivity with BINARY VALUES

Posted on 2009-02-18
2
Medium Priority
?
577 Views
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)
0
Comment
Question by:phipsta
2 Comments
 
LVL 9

Accepted Solution

by:
Rob Siklos earned 1000 total points
ID: 23669952
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
 

Author Comment

by:phipsta
ID: 23670805
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

Featured Post

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article shows the steps required to install WordPress on Azure. Web Apps, Mobile Apps, API Apps, or Functions, in Azure all these run in an App Service plan. WordPress is no exception and requires an App Service Plan and Database to install
In this article, I’ll talk about multi-threaded slave statistics printed in MySQL error log file.
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses
Course of the Month17 days, 8 hours left to enroll

831 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