Generate DDL for a Db2 LUW database
Introduction
this page explains how to generate DDL for a Db2 for LUW database using the db2look tool .
Extraction example
The db2look tool provided by IBM generates the DDL statements by object type.
For example:
DDL extraction of all objects from the TEST database
db2look -d TEST -a -e -o c:\temp\DB2_SQL\TEST_DDL.sql
DDL extraction for a specific schema using a specific user
db2look -d TEST -z CASTPUBS -i db2admin -w db2admin -e -o c:\temp\DB2_SQL\CASTPUBS_DDL.sql
Check if your code is valid SQL
For example, the following is not valid SQL, it seems to be more Mainframe script:
Mainframe alike script - NOK
Create Table 000038000
ABC 000039000
(COL_D INT) 000039010
; 000034000
The correct script should look like this :
SQL alike script - OK
Create Table
ABC
(COL_D INT)
;