amir100 Posted June 16, 2005 Posted June 16, 2005 Hi all, I have a case here. I have a table named "user" with two fields, "username" and "password". Within the table, I have three records with username "adin", "anida", and "admin". I tried this query: SELECT username FROM users WHERE (username = 'Adin') I expect the query returns 0 result. But no, the query returns 1 row, the row with the username "adin". Can someone explain what's wrong? Thanks. Quote Amir Syafrudin
penfold69 Posted June 16, 2005 Posted June 16, 2005 String comparisons are case-insensitive, unless you explicitly state that they need to be case-sensitive. How you do that can depend on the server you're using. For SQL server, check out: http://vyaskn.tripod.com/case_sensitive_search_in_sql_server.htm B. Quote
iebidan Posted June 16, 2005 Posted June 16, 2005 String comparisons are case-insensitive, unless you explicitly state that they need to be case-sensitive. How you do that can depend on the server you're using. For SQL server, check out: http://vyaskn.tripod.com/case_sensitive_search_in_sql_server.htm B. As penfold69 said, but having a case sensitive or not database depends on the collation you are using, check the SQL Books documents to see which collation is cases-insensitive in your language Quote Fat kids are harder to kidnap
amir100 Posted June 17, 2005 Author Posted June 17, 2005 As penfold69 said' date=' but having a case sensitive or not database depends on the collation you are using, check the SQL Books documents to see which collation is cases-insensitive in your language[/quote'] Yupe, I guess it's the collation. The link refered by penfold69 is great. The articles shows many methods to solve my problem. The one I choose is changing the collation of the column directly to the server. Thx for the help. :D Quote Amir Syafrudin
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.