d_barszczak Posted August 11, 2006 Share Posted August 11, 2006 Hi,I know that MySql is case sensitive but is there any way to ignore case sensitivity so in a table full of names i could search david% and all names begining with David or david or dAvId would be returned.Thanks. Quote Link to comment Share on other sites More sharing options...
effigy Posted August 11, 2006 Share Posted August 11, 2006 MySQL is case [b]in[/b]sensitive, unless there is a configuration option I'm unaware of.[tt]select * from table where name like 'david%'[/tt] should give you what you want, including dAvidA, DAVIDb, daviDc, etc.[tt]select * from table where name like binary 'david%'[/tt] should keep 'david' lowercase, resulting in davidA, davidB, davidc, etc. Quote Link to comment Share on other sites More sharing options...
d_barszczak Posted August 14, 2006 Author Share Posted August 14, 2006 Hmmm,Think i may have applyed a setting then as if i perform the query "WHERE name like 'd%'" i get nothing but if i do this "WHERE name like 'D%'" i get the results im after.Thanx. Quote Link to comment Share on other sites More sharing options...
fenway Posted August 14, 2006 Share Posted August 14, 2006 Post the table structure -- you might be using a case-sensitive collation on this column/table. Quote Link to comment Share on other sites More sharing options...
d_barszczak Posted August 16, 2006 Author Share Posted August 16, 2006 Ok here is the table in question.[code]+-------+-------------+-----------+------+-----+---------+-------+----------------------+---------+| Field | Type | Collation | Null | Key | Default | Extra | Privileges | Comment |+-------+-------------+-----------+------+-----+---------+-------+----------------------+---------+| name | varchar(40) | ascii_bin | YES | | | | select,insert,update | || age | int(11) | | YES | | | | select,insert,update | || sex | varchar(1) | ascii_bin | YES | | | | select,insert,update | |+-------+-------------+-----------+------+-----+---------+-------+----------------------+---------+[/code] Quote Link to comment Share on other sites More sharing options...
fenway Posted August 16, 2006 Share Posted August 16, 2006 Well, those look like binary collations, meaning they're case sensitive -- that's not the default, so your DB must have a different character set? You can either change the collation on the table, or simply collate as part of your query. Quote Link to comment Share on other sites More sharing options...
d_barszczak Posted August 16, 2006 Author Share Posted August 16, 2006 ahh so thats my problem.I have always used an web hosting company to manage my mysql server but this is my test server that i have at home.I changed it to ascii_bin as i think the default was something like latin_sweedish or something.So it's the collation.Shortly after i made the post i realised that i have used case-insensitive queries before.Thank you for your help Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.