Generate DDL For a Table

How To:

To generate DDL for a table, follow the steps below:



See Also


In the diagram, right-click on the table for which to generate DDL

The context menu displays



Select the Generate DDL option

The Generate DDL dialog displays



In the Path field, use the (  ...  )  (Browse) button to select the filename of the script to create



To include comments in the DDL, in the Comment Level field select the appropriate level

For example, Column for comments on columns, or All for comments on all structures



Select the checkboxes for the appropriate inclusions; for example, to include a 'drop table' command in the script, select the Create Drop SQL checkbox

Deselect the checkboxes for inclusions you do not require



To create the DDL, click on the Generate button



To view the output, click on the View button (you must configure a DDL viewer in the Local Settings dialog first)



  • In the Corporate, Business and Software Engineering, System Engineering and Ultimate editions of Enterprise Architect, if security is enabled you must have Generate Source Code and DDL permission to generate DDL
  • Some checkboxes display only if the appropriate database is defined for the table; for example, IF EXISTS displays only if the database for the table is PostgreSQL, and SEQ_ and _SEQ radio buttons display only if the database for the table is Oracle
  • For a PostgreSQL database, you must select the Generate Sequences checkbox to enable auto increment columns to be created
  • If generating Oracle sequences, you must always select the Generate Triggers and Generate Sequences checkboxes - this ensures that a pre-insert trigger is generated to select the next sequence value to populate the column; also set the AutoNum property to True in the column properties
  • If generating Oracle sequences, to generate the sequence name and trigger name with the syntax SEQ_<sequence_name>  and TRG_<trigger_name>, select the SEQ_ option; conversely, to generate them with the syntax <sequence_name>_SEQ and SET_<trigger_name>, select the _SEQ option

Learn More: