Naming Key Constraints

Naming key constraints helps you to identify and customize key constraints in scripts for database creation and modification. The constraint name gives you greater flexibility for modifying keys in subsequent database generations.

A primary key constraint is a named check that enforces the uniqueness and the presence of values in a primary key column. If you do not specify a constraint name, PowerDesigner creates a default constraint name automatically.

  1. Open the property sheet of the table and click the Keys tab, select a primary, alternate, or foreign key, and click the Properties tool to open its property sheet.
  2. Enter the required name in the Constraint Name box.

    You can use the following variables in the constraint name:

    Variable

    Description

    %TABLE%

    Code of the table

    %AK%

    Code of the alternate key

    %AKNAME%

    Name of the alternate key

    %REFRNAME%

    Name of the reference

    %REFRCODE%

    Code of the reference

    %PARENT%

    Code of the parent table

    %CHILD%

    Code of the child table

    For a complete list of PowerDesigner variables, see Writing SQL using PDM Variables and Macros.

    The User-Defined button to the right of the Constraint field is pressed automatically. You can return to the default constraint name by re-clicking the User-Defined button.

  3. Click OK in each of the dialog boxes.