Click to Rate and Give Feedback
MSDN
MSDN Library
SQL Server
SQL Server 2008
Database Engine
Development
Tables
Designing Tables
 UNIQUE Constraints
Community Content
In this section
Statistics Annotations (1)
Collapse All/Expand All Collapse All
Other versions are also available for the following:
SQL Server 2008 Books Online (October 2009)
UNIQUE Constraints

You can use UNIQUE constraints to make sure 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 for 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 be referenced by a FOREIGN KEY constraint.

Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
SQL Server uniqueidentifier solution      Jeff Fischer   |   Edit   |   Show History

Refer to my blog for best practices on using uniqueidentifier sql server 2008.

Jeff Fischer

Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks | Privacy Statement
Page view tracker