Previous Topic

Next Topic

Book Contents

Book Index

Simple DDL Generator

DDL stands for Data Definition Language, and consists of the SQL statements that create your Tables and Views (and other objects).

AQT has two DDL generators:

While the simple DDL generator has been superceded by the full DDL generator, we have retained the simple DDL generator in AQT. This is available to users of the Standard Edition of AQT.

Using the DDL Generator window

The simple DDL generator can be invoked from the Database Explorer window by clicking on Tools > Generate DDL.

Task

how

notes

select the tables / views you want to generate DDL for

click on the Select column in the grid

Select All selects all objects

Select None de-selects them all

select the type of object you wish to generate DDL for

use the Generate DDL for box

if your list of objects contains both tables and views

select whether you want to generate column comments and/or default values

in the Options box

For DB2 z/OS the system cannot generate default values successfully because of the complex way in which these are held in the catalog

as a developer you may be wanting to create a copy of a view on your own database in order to test a program you are developing.

use the Generate views as tables option

Normally AQT will generate the view DDL as in the original Create View statement – this might be a complex query involving multiple tables and views. This view can only be created by first creating all these base tables/views, which means that creating the view becomes a large job.

Instead, when you select Generate views as tables, AQT will generate DDL for a table which looks just like the view. Not only can this be easily created, but test data can easily be loaded because you create a table instead of a complex view.

specify whether the columns are defined using the native data types (char, integer etc), or user-defined types (SQL Server and Sybase Enterprise only

Select native or user-defined data types

 

specify where the generated DDL is to go to

output to (a window or a file)

The window option is useful for quickly seeing what is being generated.

The window has a limit of 32K so cannot be used for a large number of tables.

specify whether the schema/creator/owner name is to be included in the Create Table/View

include schema name

You can choose a particular schema name to be used, or none at all (in which case the objects will be created under the ID of the person running the statements).

For Create View statements, the schema names of any objects referenced within the view-query are not affected by this parameter.

To generate the DDL, click on the Generate button.

Output of DDL

If output to window was selected you will see the DDL. You can copy this (to the clipboard) for pasting into a file or the Run SQL window.

If output to file was selected the DDL will go to the file. You will have the option of viewing the (first part) of this file.

Advanced Query Tool
https://www.querytool.com
© 2023 Cardett Associates Ltd. All rights reserved.