Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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.

Amir Syafrudin
Posted
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

Fat kids are harder to kidnap
Posted
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

Amir Syafrudin

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...