.AKCOLN, .FKCOLN, and .PKCOLN Macros

Repeat a statement for each alternate, foreign, or primary key column in a table.

Syntax

.AKCOLN("statement","prefix","suffix","last_suffix", "condition")
.FKCOLN("statement","prefix","suffix","last_suffix")
.PKCOLN("statement","prefix","suffix","last_suffix")

Argument

Description

statement

Statement to repeat for each column

prefix

Prefix for each new line

suffix

Suffix for each new line

last suffix

Suffix for the last line

condition

Alternate key code (if condition argument is left empty the macro returns a statement for each alternate key in the table)

Example

In a trigger for the table TITLEAUTHOR:
  • message .AKCOLN("'%COLUMN% is an alternate key column'","", "", "", "AKEY1")
    generates the following trigger script:
    message 'TA_ORDER is an alternate key column',
  • message .FKCOLN("'%COLUMN% is a foreign key column'","",",",";")
    generates the following trigger script:
    message 'AU_ID is a foreign key column,
    TITLE_ISBN is a foreign key column;'
  • message .PKCOLN("'%COLUMN% is a primary key column'","",",",";")
    generates the following trigger script:
    message 'AU_ID is a primary key column',
        'TITLE_ISBN is a primary key column';
Note: For columns, these macros only accept the %COLUMN% variable.