Case sensitive selects in MySQL
There has been a couple of reasons recently that I needed to do a look up on a MySQL table using a case-sensitive Select statement. Its actually as easy as using "LIKE BINARY" instead of "LIKE" e.g.
<cfqueryparam cfsqltype="cf_sql_varchar" value="SOmE PAssWOrD" />
1 SELECT username, password
2 FROM tablename
3 WHERE password LIKE BINARY 'SOmE PAssWOrD'
Obviously if you are on a CFML engine don't forget 2 FROM tablename
3 WHERE password LIKE BINARY 'SOmE PAssWOrD'
<cfqueryparam cfsqltype="cf_sql_varchar" value="SOmE PAssWOrD" />
TweetBacks
Comments (Comment Moderation is enabled. Your comment will not appear until approved.)
[Add Comment]
[Subscribe to Comments]
# Posted By Ben Nadel
| 2/17/10 6:17 PM
[Add Comment]