Export (0) Print
Expand All

UNIQUE Constraints

SQL Server 2000

UNIQUE Constraints

You can use UNIQUE constraints to ensure that no duplicate values are entered in specific columns that do not participate in a primary key. Although both a UNIQUE constraint and a PRIMARY KEY constraint enforce uniqueness, use a UNIQUE constraint instead of a PRIMARY KEY constraint when you want to enforce the uniqueness of a column, or combination of columns, that is not the primary key.

Multiple UNIQUE constraints can be defined on a table, whereas only one PRIMARY KEY constraint can be defined on a table.

Also, unlike PRIMARY KEY constraints, UNIQUE constraints allow the value NULL. However, as with any value participating in a UNIQUE constraint, only one NULL value is allowed per column.

A UNIQUE constraint can also be referenced by a FOREIGN KEY constraint.

See Also

Creating and Modifying UNIQUE Constraints

© 2014 Microsoft