Wednesday 24 June 2015

Case Sensitive search with SQL

If we fire following Query,
"select * from users where name = 'raja'"
it will return us all columns. Cause, all column contains same data and record search is not case Sensitive.

Default Collation of the SQL Server installation SQL_Latin1_General_CP1_CI_AS and this is not case sensitive. here is syntax to change column collation. 

 If we fire following Query,
"select * from users where name COLLATE Latin1_General_CS_AS = 'raja'"
it will return  record search is case Sensitive.

No comments:

Post a Comment