Creating a Unique Constraint or Primary Key

Creating a unique constraint or primary key constraint to ensure 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.

  1. In the left pane of the Administration Console, expand ASE Servers > Schema Objects > Tables, then choose one of the following:
    • User Tables
    • Proxy Tables
  2. Click the Name field of the table, then click the drop-down arrow and select Properties.
  3. In the left pane, click Index, then click the drop-down arrow and select Unique Constraint.
  4. On the Name screen:
    1. Specify a name for the unique constraint or primary key.
    2. Click Unique Constraint or Primary key.
    3. (Optionally) Click Make supporting index clustered.
  5. On the Columns screen, select the columns to include in the unique constraint or primary key.
  6. On the Database Segment screen, select a segment on which to place the unique constraint or primary key.
  7. On the Space Management screen:
    1. (Optional) Specify a fill factor percentage.
    2. (Optional) Specify the maximum number of rows per page for the index.
    3. (Optional) Specify the ratio of empty pages to filled pages to provide for expansion.
  8. (Optional) Click Summary to review your selected options.
  9. Click Finish.
Related tasks
Creating a Check Constraint
Creating a Foreign Key
Binding Defaults and Rules to a Column