Click here to Skip to main content
15,895,011 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how to make sql server data case sensitive.. i am making simple login page.. but username is not case sensitive in sql server.. it works on with both in query e.g
HTML
where username='DAVID' AND on where username='david'

i want to make it case sensitive
Posted

Result of this query depends on the type of collation you have chosen.
By default it's case insensitive (CI).
You can change it on database level or on specific column.
Take a look at these articles:
http://msdn.microsoft.com/en-us/library/ms184391.aspx[^]
http://msdn.microsoft.com/en-us/library/ms144260.aspx[^]
 
Share this answer
 
Comments
ProEnggSoft 19-Mar-12 14:44pm    
+5
SQL
where username=@username COLLATE SQL_Latin1_General_CP1_CS_AS


This will compare the case of username column and the @username parameter being passed in.
 
Share this answer
 
Comments
ProEnggSoft 19-Mar-12 14:43pm    
+5

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900