I would like to generate DDL script file for a table. I would love to do this with SQL statement, but I would except a CLPPLUS or CLP solution. Can this be done with db2look? I have tried but always get way too much detail.
db2look -d 'MY_DB' -z 'DB2INST1' -t 'MY_TABLE' -e -o MY_TABLE.sql
db2look -d 'MY_DB' -z 'DB2INST1' -t 'MY_TABLE' -e -noview -nofed -x -o MY_TABLE.sql
I want only the basic DDL (the create table statement), I do not want any on the additional details about the table.
There is no way to make db2look
print DDL for the CREATE TABLE
statement only.
If you are on Linux / Unix, you may try the following:
db2look -d MY_DB -z DB2INST1 -t MY_TABLE -e -noview -nofed \
| awk -v RS='' '/CREATE TABLE/' \
| tee MY_TABLE.sql