String case question

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
Shendemiar
Forum Contributor
Posts: 404
Joined: Thu Jan 08, 2004 8:28 am

String case question

Post by Shendemiar »

Code: Select all

SELECT * FROM `x_roope_strings` WHERE `string`='Ka_la'
Is not case sensitive. How do i match only exactly "Ka_la"?
Shendemiar
Forum Contributor
Posts: 404
Joined: Thu Jan 08, 2004 8:28 am

Post by Shendemiar »

Not sure what it means, but i "altered my table structure to have the strings to have case sensitive collation".

Now it works the way i want to.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Setting the column to BINARY would make it case sensitive.
User avatar
Gente
Forum Contributor
Posts: 252
Joined: Wed Jun 13, 2007 9:43 am
Location: Ukraine, Kharkov
Contact:

Post by Gente »

Also you can use UPPER() and LOWER() functions but be attentive with character set
User avatar
superdezign
DevNet Master
Posts: 4135
Joined: Sat Jan 20, 2007 11:06 pm

Post by superdezign »

feyd wrote:Setting the column to BINARY would make it case sensitive.
You can also just use the BINARY keyword in the query. I use it on logins so that no user can sign up with the same name having different cases, but they have to login with the same case that they signed up with.
Post Reply