If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > Renaming a column

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 05-17-04, 13:25
dsusendran dsusendran is offline
Registered User
 
Join Date: Apr 2004
Location: Inside Intel
Posts: 165
Post Renaming a column

Hi all,

DB2 8.1.5 on Win2000 server

I have a table with data populated in it. I want to rename a column. Is there a "ALTER TABLE TableName RENAME COLUMN OldName TO NewName"?? Or do i have to drop and redo everything?

Thanks in advance,
Newbie
Reply With Quote
  #2 (permalink)  
Old 05-17-04, 13:41
bmujeeb bmujeeb is offline
Registered User
 
Join Date: Mar 2004
Posts: 448
No rename command.
drop and create and redo all.
use db2look to get the existing table information.

regards,

mujeeb
Reply With Quote
  #3 (permalink)  
Old 05-17-04, 17:31
dsusendran dsusendran is offline
Registered User
 
Join Date: Apr 2004
Location: Inside Intel
Posts: 165
Post Thanks!

Thanks mujeeb!

I wonder why that feature is not available in DB2. Anybody??
Reply With Quote
  #4 (permalink)  
Old 05-17-04, 18:04
bmujeeb bmujeeb is offline
Registered User
 
Join Date: Mar 2004
Posts: 448
The reason is simple, db2 keeps lot of information at the column level and any changes will invalidate and inoperative that other objects.
Infact , in oracle until 9i release 2 they have no command of renaming the column and the reason at the oracle is that it keeps that information at the block level(not by name) and the same I think is for db2 at the page level

regards,

mujeeb
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On