Pages

Tuesday, May 29, 2012

SQL case sensitive

ALTER TABLE mytable
ALTER COLUMN mycolumn VARCHAR(10)
COLLATE SQL_Latin1_General_CP1_CS_AS

This will change the column to be case sensitive.
Any selects or joins on this column will become case sensitive

OR

To perform case sensitive comparison for single query add "COLLATE Latin1_General_CS_AS" in where condation
SELECT *  FROM Users
where Uname COLLATE Latin1_General_CS_AS = 'Name'

No comments:

Post a Comment