Unique Index with SQL Server

If you need a unique constraint on a column, but you also plan on doing lookups and filters based on the value in that column, you might want to use a Unique Index instead.  It looks like this:

CREATE UNIQUE NONCLUSTERED INDEX
ConstraintName ON dbo.TableName
(
ColumnName
) ON [PRIMARY]
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s