Pkey

The Pkey category is located in the Root > Script > Objects category, and can contain the following items that define how primary keys are modeled for your DBMS.

Item

Description

[Common items]

The following common object items may be defined for primary keys:

  • Add

  • ConstName

  • Create, Drop

  • Enable

  • Options, DefOptions

  • ReversedQueries

For a description of each of these common items, see Common object items.

EnableCluster

Specifies whether clustered constraints are permitted on primary keys.

  • Yes - Clustered constraints are permitted.

  • No - Clustered constraints are not permitted.

PkAutoIndex

Determines whether a Create Index statement is generated for every Primary key statement. The following settings are available:

  • Yes - Automatically generates a primary key index with the primary key statement. If you select the primary key check box under create index when generating or modifying a database, the primary key check box of the create table will automatically be cleared, and vice versa.

  • No - Primary key indexes are not automatically generated. Primary key and create index check boxes can be selected at the same time.

PKeyComment

Specifies a statement for adding a primary key comment.

UseSpPrimKey

Specifies the use of the Sp_primarykey statement to generate primary keys. For a database that supports the procedure to implement key definition, you can test the value of the corresponding variable %USE_SP_PKEY% and choose between the creation key in the table or launching a procedure. The following settings are available:

  • Yes - The Sp_primarykey statement is used to generate primary keys.

  • No - Primary keys are generated separately in an alter table statement.

Example (ASE 15):

If UseSpPrimKey is enabled the Add entry for Pkey contains:

UseSpPrimKey = YES
Add entry of 

[%USE_SP_PKEY%?[execute] sp_primarykey %TABLE%, %PKEYCOLUMNS%
:alter table [%QUALIFIER%]%TABLE%
 add [constraint %CONSTNAME%] primary key [%IsClustered%] (%PKEYCOLUMNS%)
  [%OPTIONS%]]