Create a unique key that is case sensitive

To apply case sensitive on particular column we modify the column below way.

ALTER TABLE mytable

ALTER COLUMN mycolumn VARCHAR(10)

COLLATE SQL_Latin1_General_CP1_CS_AS

After create constraint on column

ALTER TABLE MYTABLE

ADD CONSTRAINT UK_MYTABLE_MYUNIQUEKEY UNIQUE NONCLUSTERED (MYCOL)

Advertisements