Home / Software / Tips and Tricks / Case Sensitive SQL Query Search in SQL SERVER.

Case Sensitive SQL Query Search in SQL SERVER.

Updated:  02/13/2012 04:02 AM
Author:  Shiju Mathews

Status:    Resolved.


Most of the developers will forget that SQL select statements are not case sensitive in normal ‘Select’ statements.

Default Collation of the SQL Server installation SQL_Latin1_General_CP1_CI_AS is not case sensitive.



RESULTS:

(1 row(s) affected)

(1 row(s) affected)
EmployeeNo Name Salary Entry
----------- ---------------------------------- ----------- -----
1 Shiju Kadamala 12000 2012-02-13 10:06:25.070

(1 row(s) affected)


Adding COLLATE Latin1_General_CS_AS makes the search case sensitive.

In order to make the search case sensitive make the following changes in Query :


RESULTS:
(0 row(s) affected)

To change the collation of the any column for any table permanently run following query.


As you can see, this SQL Server has a case insensitive collation



results:
---------------------
SQL_Latin1_General_CP1_CI_AS
(1 row(s) affected)


This indicates that the server is not case sensitive.