Creating a primary key constraint ensures that no two rows in a table have the same values in the specified columns.
A primary key is a column or combination of columns that uniquely identifies
a row. It cannot be NULL and it must have a unique index. A table with a
primary key is eligible for joins with foreign keys in other tables. Think of the primary
key table as the master table in a master-detail relationship.
There can be many such master-detail groups in a database.
- In the Perspective Resources view, select the server on which the table resides, then click the drop-down arrow next to the server name and select Administration Console.
- In the left pane of the Administration Console, expand , then choose one of the following:
- Select the table for the primary key.
- Select Properties.
- From the Table Properties window, select .
You see the Add Unique Constraint wizard.
- Specify a name, then select Primary key.
- (Optionally) Click Make supporting index clustered.
- Select the columns to include in the primary key.
- Select a segment on which to place the primary key.
- (Optional) Specify a fill factor percentage.
- (Optional) Specify the maximum number of rows per page for the index.
- (Optional) Specify the ratio of empty pages to filled pages to provide for expansion.
- (Optional) Click Summary to verify your selected options.