Is there an easy way to copy a table to the same database of course with different name. I tried some of these listed below,
db2 "CREATE TABLE SCHEMA.NEW_TB COPY AS SELECT * FROM SCHEMA.OLD_TB WHERE 1 = 2"
db2 "SELECT INTO SCHEMA.NEW_TB FROM SCHEMA.OLD_TB"
db2 "SELECT * FROM SCHEMA.OLD_TB INSERT INTO SCHEMA.NEW_TB"
None of these worked I am using db2 v9.5
Try this:
CREATE TABLE SCHEMA.NEW_TB LIKE SCHEMA.OLD_TB;
INSERT INTO SCHEMA.NEW_TB (SELECT * FROM SCHEMA.OLD_TB);
Options that are not copied include: