Previous Topic: Generate Database Schema OptionsNext Topic: Forward and Reverse Engineering Physical Storage Objects


Example - Physical or Column Order in Forward Engineering

In the Schema Generation Dialog, Column Options tab, you have the option to select or clear the Physical Order check box. By default this check box is selected, to preserve the physical order of the columns in the generated schema. You can clear this check box to use ordinary column order in the generated schema. Note that if you select Physical Order, the column order is still used to establish the Primary Keys, Alter statements, etc. in the generated schema.

The following examples illustrate the two different display levels, and their effect on the SQL schema generation during forward engineering.

Example 1 The Physical Order Display Level is selected in the model. When this table is forward engineered, the Physical Order check box is selected in the Schema Generation Dialog, Column Options tab.

generates the following SQL:

CREATE TABLE Order_Example (
PK_Order1 CHAR(18) NOT NULL,
PK_Order2 CHAR(18) NOT NULL,
PK_Order3 CHAR(18) NOT NULL,
Non_PK_Order4 CHAR(18) NULL,
Non_PK_Order5 CHAR(18) NULL,
Non_PK_Order6 CHAR(18) NULL
);

ALTER TABLE Order_Example
ADD ( PRIMARY KEY (PK_Order3, PK_Order2, PK_Order1) ) ;

Example 2 The Column Order Display Level is selected in the model. When this table is forward engineered, the Physical Order check box is cleared in the Schema Generation Dialog, Column Options tab.

generates the following SQL:

CREATE TABLE Order_Example (
PK_Order3 CHAR(18) NOT NULL,
PK_Order2 CHAR(18) NOT NULL,
PK_Order1 CHAR(18) NOT NULL,
Non_PK_Order4 CHAR(18) NULL,
Non_PK_Order5 CHAR(18) NULL,
Non_PK_Order6 CHAR(18) NULL
);

ALTER TABLE Order_Example
ADD ( PRIMARY KEY (PK_Order3, PK_Order2, PK_Order1) ) ;