I have created a table in dashDB from a CSV file using the console load functionality.
How can I get the table DDL using only the dashDB console?
I have created a table in dashDB from a CSV file using the console load functionality.
How can I get the table DDL using only the dashDB console?
In the end, I viewed the table definition and selected the html and pasted it into a text editor.
dblook
would have been a better option, but I couldn't get the command lines tools setup with ssl support.
You can download the runtime client that includes the tools such as db2look from here for free: https://www-01.ibm.com/marketing/iwm/iwm/web/preLogin.do?source=swg-idsclt and catalog your dashDB instance and database.
For dashDB Local, try the below command to display the SQL DDL statement (CREATE TABLE) that was used to create a table. I tried this from the Docker CLI client that I was able to launch from the Kitematic window.
docker exec -it dashDB db_ddl_table -db bludb
Here is a snapshot of the output I am seeing:
bash-3.2$ docker exec -it dashDB db_ddl_table -db bludb
-- Timestamp: Fri Jun 24 20:46:39 UTC 2016
-- Database Name: bludb
-- DDL Statements for Table "IBMADT "."AUDITTRAIL"
CREATE TABLE "IBMADT "."AUDITTRAIL" (
"RECORDID" BIGINT NOT NULL GENERATED ALWAYS AS IDENTITY (
START WITH +1
INCREMENT BY +1
MINVALUE +1
MAXVALUE +9223372036854775807
NO CYCLE
CACHE 20
NO ORDER ) ,
"ACTIVITYTIME" TIMESTAMP NOT NULL WITH DEFAULT CURRENT TIMESTAMP ,
"ACTIVITYTYPE" VARCHAR(30 OCTETS) NOT NULL ,
"ACTIVITYPARAMS" VARCHAR(255 OCTETS) ,
"USERID" VARCHAR(255 OCTETS) NOT NULL ,
"USERROLE" VARCHAR(20 OCTETS) NOT NULL ,
"REMOTEHOST" VARCHAR(255 OCTETS) ,
"SESSIONID" VARCHAR(255 OCTETS) ,
"RESPONSECODE" CHAR(5 OCTETS) )
IN "USERSPACE1"
ORGANIZE BY ROW@
-- DDL Statements for Primary Key on Table "IBMADT "."AUDITTRAIL"
ALTER TABLE "IBMADT "."AUDITTRAIL"
ADD PRIMARY KEY
("RECORDID")@
-- DDL Statements for Table "DB2GSE "."GSE_COORDINATE_SYSTEMS"
CREATE TABLE "DB2GSE "."GSE_COORDINATE_SYSTEMS" (
"COORDSYS_NAME" VARCHAR(128 OCTETS) NOT NULL ,
"DEFINITION" VARCHAR(2048 OCTETS) NOT NULL ,
"ORGANIZATION" VARCHAR(128 OCTETS) ,
"ORGANIZATION_COORDSYS_ID" INTEGER ,
"DESCRIPTION" VARCHAR(256 OCTETS) ,
"DEFINER" VARCHAR(128 OCTETS) NOT NULL WITH DEFAULT USER )
IN "USERSPACE1"
ORGANIZE BY ROW@