If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > Binary in where statement

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 04-11-11, 14:56
bono56 bono56 is offline
Registered User
 
Join Date: May 2004
Posts: 133
Binary in where statement

hi
i use statement as follows for checking user/pass of users:
Code:
SELECT COUNT(*) AS num FROM `tbUsers` WHERE BINARY username = 'un' AND password = 'pw'
it considers both username and password case-sensetive, how can i change the statement the way that only password considered case-sensetive.
i think BINARY operand affect the entire where statement, am i right?
__________________
Lyrics Database: www.shermani.com
Reply With Quote
  #2 (permalink)  
Old 04-11-11, 17:17
it-iss.com it-iss.com is offline
Registered User
 
Join Date: Sep 2009
Location: San Sebastian, Spain
Posts: 620
The binary operator converts a string to an array of bytes and compares the results byte by byte. This only applies to the variable preceding the BINARY reserved word.

I am not sure why you would want to convert it to a binary and not compare it at a string level?
__________________
Ronan Cashell
Senior Oracle/MySQL DBA
http://www.it-iss.com
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On