Hi Team ,
Can some one tell me why we dont we have a DROP column or rename a
column command in DB2 ? I Have a very Huge table and need to rename a
column . The only option i have to do to rename a column which i by
mistake spelled it wrong was to drop the Whole Table ????
Thanks in Advance ,
Kamal.
Serge Rielau - 03 Apr 2008 17:59 GMT
> Hi Team ,
>
> Can some one tell me why we dont we have a DROP column or rename a
> column command in DB2 ? I Have a very Huge table and need to rename a
> column . The only option i have to do to rename a column which i by
> mistake spelled it wrong was to drop the Whole Table ????
You can DROP COLUMN in DB2 9 for LUW.
So you can do:
SET INTEGRITY... OFF
ALTER TABLE ... ADD COLUMN ...GENERATED ALWAYS AS (oldcolname);
SET INTEGRITY .. FORCE GENERATED;
ALTER TABLE .. DROP GENERATED
ALTER TABLE .. DROP COLUMN oldcolname
REORG
Cheers
Serge

Signature
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab