Altering Mysql Table column to be case sensitive
ALTER TABLE USERS CHANGE USER_NAME USER_NAME VARCHAR(50) BINARY NOT NULL;
Please see http://dev.mysql.com/doc/refman/5.0/en/charset-conversion.html
Example:
ALTER TABLE some_table MODIFY some_column BLOB;
ALTER TABLE some_table MODIFY some_column VARCHAR(50) BINARY;
The first line converts to a binary data type (attempt to minimize character loss) and the second converts back to the VARCHAR
type with BINARY
collation.
It may actually be preferable to store as one of the binary types (BLOB
, BINARY
, or VARBINARY
) rather than simply collating BINARY
. I would suggest you compare a bit, your mileage may vary depending on your actual data and the queries you need to run.