Jump to content


Photo

Case-sensitive comparison


  • Please log in to reply
2 replies to this topic

#1 AndyB

AndyB
  • Staff Alumni
  • Advanced Member
  • 5,465 posts
  • LocationToronto

Posted 02 June 2006 - 12:35 AM

Nothing leapt out of the manual or a search at MySQLFreaks :(

MySQL version 4.0.27 Standard and I want to do a case-sensitive comparison in a database query between a user-entered string (albeit cleaned up) and a varchar field. = fails, LIKE fails, and STRCMP fails - unless I screwed up a simple query. How do I do a case-sensitive comparison?

Legend has it that reading the manual never killed anyone.
My site

#2 fenway

fenway
  • Staff Alumni
  • MySQL Si-Fu / PHP Resident Alien
  • 16,199 posts
  • LocationToronto, ON

Posted 02 June 2006 - 02:32 AM

If I recall correctly, pre-4.1 you need to use the BINARY operator to get the case to "stick"; never even though of using strcmp.


Seriously... if people don't start reading this before posting, I'm going to consider not answering at all.

#3 AndyB

AndyB
  • Staff Alumni
  • Advanced Member
  • 5,465 posts
  • LocationToronto

Posted 02 June 2006 - 02:36 AM

Binary is exactly what did the trick. Thanks.
Legend has it that reading the manual never killed anyone.
My site




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users