Set column as unique in SQL Server from the GUI:
They really make you run around the barn to do it with the GUI:
Make sure your column does not violate the unique constraint before you begin.
- Open SQL Server Management Studio.
- Right click your Table, click "Design".
- Right click the column you want to edit, a popup menu appears, click Indexes/Keys.
- Click the "Add" Button.
- Expand the "General" tab.
- Make sure you have the column you want to make unique selected in the "columns" box.
- Change the "Type" box to "Unique Key".
- Click "Close".
- You see a little asterisk in the file window, this means changes are not yet saved.
- Press Save or hit Ctrl+s. It should save, and your column should be unique.
Or set column as unique from the SQL Query window:
alter table location_key drop constraint pinky;
alter table your_table add constraint pinky unique(yourcolumn);
Changes take effect immediately:
Command(s) completed successfully.