I have a table called countries
and I define the country_name
column to be unique by creating a “Index/Key” of type “Unique Key” on SQL Server 2008 R2.
One of most important point is suppose you want to keep column value null with maintaining uniqueness you can't do with unique key constraint but with unique key index u can keep column value null with maintain uniqueness. so if you need column unique with Null-able type Unique Index required else if you need column not null-able then unique key constraint required.