Please note : This help page is not for the latest version of Enterprise Architect. The latest help can be found here.

Generate DDL For a Table

Access    Diagram Table element context menu | Generate DDL


On the Generate DDL dialog, generate DDL for a table as indicated below:



See also


Click on the (  ...  )  (Browse) button to set up the file location and file name of the script to create.



Comment Level

To include comments in the DDL, select the appropriate level.

For example, select Column to include comments on columns, or All to include  comments on all structures.



Option Checkboxes

Select the checkbox for each type of inclusion you require; 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.




Click on this button to create the DDL.




Click on this button to view the output.

The viewer defaults to the Enterprise Architect default code editor. However, you can define an alternative default DDL editor on the Options dialog (Tools | Options | Source Code Engineering | Code Editors).


Editing Source Code

Options - Code Editors


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