How to filter case sensitive data in sqlserver 2008 ?


Hi
Today i was working on one of my personal project, there was requirement to filter the field from database on basis of case sensitive. For example user has given password “TEST” then database should not accept “Test” as input password.

Sqlserver default it will be in-case sensitive. We have to make it case sensitive like this

We can do using so many approach like this

First Method

Select EmpName from tblEmp where BINARY_CHECKSUM(EmpName)=BINARY_CHECKSUM(‘Hello’)

Second Method

Select EmpName from tblEmp where EmpName=’Hello’ COLLATE SQL_Latin1_General_CP1_CS_AS

Select EmpName from tblEmp where EmpName COLLATE Latin1_General_CS_AS=’Hello’

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.