Unique Keys Wizard (SQL Server)
Go Up to Microsoft SQL Server Object Wizards
Unique keys can enforce logical keys that are not chosen as the primary key. In other words, you can use a unique key to ensure no duplicate values are entered in specific columns that are not a part of the primary key. Although you can only attach one primary key to a table, you can attach multiple unique keys. Also, you can use unique keys on columns that allow null values.
To create a new unique key using a wizard:
- Open a creation wizard for a unique key. For details, see Opening an Object Wizard.
- Use the following topics as a guide to setting properties and performing tasks as you pass through the wizard panels:
- Properties panel - Unique Keys (SQL Server) - Properties.
- Columns panel - Unique Keys (SQL Server) - Columns.
- DDL View panel - for details, see Previewing the DDL Generated to Create the New Object.
- Finally, use the Execute button to create the object.
Unique Keys (SQL Server) - Properties
When creating or editing a unique key, this tab/panel lets you work with the following settings:
Setting | Description |
---|---|
Table Owner and Table Name |
Choose the owner and name of the table in which the unique key is being created. |
Name |
Provide a name of the unique key being created. |
Build Online |
Enabling this feature specifies that the ONLINE=ON clause is used when creating this object and can subsequently be used when rebuilding or dropping this object. |
Max degree of parallelism |
Lets you specify a MAXDOP index operation value, limiting the number of processors used in parallel plan execution. |
Clustered |
Enable or disable clustering. With this check box enabled, subsequent rebuild and drop operations offer an online option. |
File Group |
If you do not specify a filegroup, Microsoft SQL Server creates the unique key in the default filegroup. |
Fill Factor |
This specifies how full each index page that’s storing data should be. The fill factor is a percentage value between 0 and 100. |
Unique Keys (SQL Server) - Columns
From the Column dropdown, select a column for the primary key and specify a Sort option. To add more columns, click the New button and then follow the steps in the last instruction. Use the Delete button to drop columns.