I am using SQL Server database to store information for my application.
One of the columns in a table has to store the case sensitive data.
How should I set this one specific column in the table to be case sensitive?
EDIT:
1) I use linq to sql for the query
2) I store in the DB info that mast be Case sensative
You can override the collation at the column level and set it to a case sensitive collation.
Following script shows two different ways.
In the collation
Latin1_General_CS_AS, CS stands forCASE SENSITIVERead here to know more about SQL Server Collation.
Set collation during create table
Create script with collation
Set collation during alter table
Create script with no collation
Alter script to set the collation
Sample that demonstrates with test data
Populate table script
Script searching on case sensitive column: SQL Fiddle demo
Output:
Script searching on case insensitive column: SQL Fiddle demo
Output: