About this question
When I want a column to have distinct values, I can either use a constraint create table t1( id int primary key, code varchar(10) unique NULL ); go or I can use a unique index create table t2( id int primary key, code varchar(10) NULL ); go create unique index I_t2 on t2(code); Columns with unique constraints seem to be good candidates for unique indexes. Are there any known reasons to use unique constraints and not to use unique indexes instead? How to create unique index sql server?