Monday, March 19, 2012

Make SQL Queries Case Sensitive

Hi,

I have an SQL Server 2000 database. There is a table for User Logins. I want the query to be executed as case sensitive. I mean if the database has a username like "USER1" and the user enters his username as "user1" then the login should fail.

So, Is there some way I can make SQL case sensitive? Please help

Regards

Vineed

This is a collation issue. Assuming your table name is UserTable and the field that holds username is UserName (varchar(50)), you can alter your table as follows:

Code Snippet

Alter Table UserTable Alter Column UserName (varchar(50) collate latin1_general_CS_AS)

If you want case insensitive, change CS to CI.

|||

Hi,

Thanks for your time. Really helped.

Thanks again

Regards

Vineed

No comments:

Post a Comment