Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Does DB2 allow the renaming of the field's name in a table?

Status
Not open for further replies.

fletchsod

Programmer
Dec 16, 2002
181
Just curious, does DB2 allow the renaming of the field's name in a table?

I know that DB2 version 6.1 doesn't. The other alternative is to built a new table then pour the data from the old table into a new table. (Suck though).

I'm just wondering if the newer version does...

Thanks...
 
We have DB2 8.2 & all it does (not successfully most of the times - I tried it & it did not work...) via the system routine ("SYSPROC.ALTOBJ" )drops the table and its related objects and re-creates it with a new clm name; creates a back-up of the "old" table & does the LOAD.
The load copy is saved as .dat file.

so, you'd be better off not re-naming columns at all!
yaks

cheers!
Crtisi
 
So, it can't be renamed via the SQL Query? Like MySQL does...
 
fletchsod,

I don't know MYSQL, but you can certainly SELECT COLUMNNAME AS NEWCOLUMN. Not sure if that is what you are after though.......

Marc
 
Currently, DB2 version 8 does not support renaming or dropping columns. I don't know if they have any plans to add that feature in later releases. If you really need to do it, you will probably have to save your data in a temporary table, drop and recreate your table with the new field name, and then re-populate the data from your temp table.
 
Yea, that's what I'm afraid of... :-/ I finished with 2 tables already, so 2 tables down and 16 more tables to go. Plus the programming changes in PHP and SQL.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top