Simple DDL operation http://pic.dhe.ibm.com/infocenter/db2luw/v9r7/index.jsp in db2? Topic =/com.ibm.db2.luw.admin.partition.doc/c0007201.html the link above is the IBM-DB2-API documentation *************************** **************************************** *************
Create table aa (aa decimal (18), bb varchar (18); remember reorg table aa after all DDL operations are completed; (reorganize the table structure) -- added the field alter table name add column field type. For example, alter table aa add column cc varchar (20); www.2cto.com -- changed the field name. Example: change aa to cc1. Add a new field cc, and then assign the value of aa to cc2. Delete aa and reorg table -- modify the field type alter table name alter field set data type; example: alter table aa alter bb set data type varchar (40); -- modify the length of a field (only large, not small) alter table name alter field set data type; example: alter table aa alter bb set data type varchar (40); www.2cto.com -- add the not null constraint to the field alter table name alter field set not null; example: alter table aa alter bb set not null; -- delete the not null constraint on the field. alter table name alter column field drop not null; example: alter table aa alter column bb drop not null; -- delete the field alter table Name drop column; for example, alter table aa drop column bb; -- copy the table structure and data create table cb_ba_CURRENCY like BASE_CURRENCY; insert into cb_ba_CURRENCY select * from BASE_CURRENCY; www.2cto.com -- ADD the unique constraint alter table employee add constraint newid unique (EMPNO, HIREDATE) -- delete the UNIQUE constraint alter table <table-name> drop unique <CONSTRAINT-name> -- ADD the primary key constraint alter table <name> add constraint <column_name> primary key <column_name> -- delete the PRIMARY KEY constraint alter table <table-name> DROP PRIMARY KEY