0
votes

I would like to rename a column in DB2 on the iSeries platform. The link below is related, however, I do not have a primary key or constraint defined on the columns I would like to rename. In addition, I'm not certain that they are on the iSeries as well. Rename column in DB2

However, I decided to give it a go with the following statement:

ALTER TABLE MYLIB.MYFILE RENAME COLUMN COL0001 TO COL0002;

Post execution, I am given the following warning: DB2 error Additionally, I do not see a RENAME COLUMN in the docs: https://www.ibm.com/support/knowledgecenter/en/ssw_ibm_i_71/db2/rbafzatabl.htm

Is this something that is not possible on V7R1 DB2?

1

1 Answers

2
votes

There is no RENAME COLUMN clause in the ALTER TABLE statement in DB2 for IBM i.
You may probably achieve the same with the following:

ALTER TABLE MYLIB.MYFILE ADD COLUMN COL0002 ...;
UPDATE MYLIB.MYFILE SET COL0002 = COL0001;
ALTER TABLE MYLIB.MYFILE DROP COLUMN COL0001;