Generate DDL For a Table


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.

To generate simple DDL scripts to create the tables in your model, follow the steps below:

  1. In the diagram, right-click on the table for which to generate DDL. The context menu displays.
  2. Select the Generate DDL option. The Generate DDL dialog displays.
    generate ddl
  3. In the Path field, use the [ ... ] (Browse) button to select the filename of the script to create.
  4. 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.
  5. 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.


  • 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.
  • 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.
  1. To create the DDL, click on the Generate button.
  2. To view the output, click on the View button (you must configure a DDL viewer in the Local Settings dialog first).