SQL 2008: How to make a column Unique

Add a unique constraint for that column:
alter table Foo add constraint UQ_Name unique (Name)
To add it through SQL Management Studio UI:
  1. Open SQL Server Management Studio.
  2. Expand the Tables folder of the database where you wish to create the constraint.
  3. Right-click the table where you wish to add the constraint and click Design.
  4. In Table Designer, click Indexes/Keys.
  5. Click Add.
  6. Choose Unique Key in the Type drop-down list.

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 )

Google+ photo

You are commenting using your Google+ 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 )


Connecting to %s