Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change the column name in DB2

Tags:

sql

db2

I need to rename the column name of one of the table. I have DB2 database and we are connecting with the database and executing sql queries through Eclipse IDE.

Thanks.

like image 355
SHAHZZ Avatar asked Feb 03 '23 13:02

SHAHZZ


1 Answers

Use an ALTER TABLE statement.

ALTER TABLE G31.TG31PDIX RENAME COLUMN RECORD_KEY TO RECORD_KEYY;

This will only work if you use a version of DB2 that supports this feature. An older version might be out of luck. I'm not sure when they added it, but it was after 2004.

like image 66
duffymo Avatar answered Feb 05 '23 05:02

duffymo