How can I make SQL case sensitive string comparison on MySQL? -


i have function returns 5 characters mixed case. if query on string return value regardless of case.

how can make mysql string queries case sensitive?

http://dev.mysql.com/doc/refman/5.0/en/case-sensitivity.html

the default character set , collation latin1 , latin1_swedish_ci, nonbinary string comparisons case insensitive default. means if search col_name 'a%', column values start or a. make search case sensitive, make sure 1 of operands has case sensitive or binary collation. example, if comparing column , string both have latin1 character set, can use collate operator cause either operand have latin1_general_cs or latin1_bin collation:

col_name collate latin1_general_cs 'a%' col_name 'a%' collate latin1_general_cs col_name collate latin1_bin 'a%' col_name 'a%' collate latin1_bin 

if want column treated in case-sensitive fashion, declare case sensitive or binary collation.


Comments

Popular posts from this blog

php - What is the difference between $_SERVER['PATH_INFO'] and $_SERVER['ORIG_PATH_INFO']? -

fortran - Function return type mismatch -

queue - mq_receive: message too long -