عینا کپی از Book OnLine:
To create a unique index
1.In Object Explorer, right-click the table and click Modify
The table opens in Table Designer.
2.From the Table Designer menu, click Indexes/Keys
3.Click Add. The Selected Primary/Unique Key or Index list displays the system-assigned name of the new index
4.In the grid, click Type
5.Choose Index from the drop-down list to the right of the property
6.Under Column name, select the columns you want to index. You can select up to 16 columns. For optimal performance, select only one or two columns per index. For each column you select, indicate whether the index arranges values of this column in ascending or descending order.
7.In the grid, click Is Unique
8.Choose Yes from the drop-down list to the right of the property
9.Select the Ignore duplicate keys option if you want to ignore data that would create a duplicate key in the unique index (with the INSERT statement).
The index is created in the database when you save the table or diagram.
Note:
You cannot create a unique index on a single column if that column contains NULL in more than one row. Similarly, you cannot create a unique index on multiple columns if the combination of columns contains NULL in more than one row. These are treated as duplicate values for indexing purposes.
و مثال با استفاده از T_SQL:
CREATE UNIQUE INDEX AK_UnitMeasure_Name
ON Production.UnitMeasure(Name);
GO