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 > Rename column in db2

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 04-19-04, 09:40
Paren Paren is offline
Registered User
 
Join Date: Jan 2004
Posts: 31
Rename column in db2

Hi, everyone
i want to learn , how can i rename column name in db2?
we are using db2 OS/390 7.0 and
i m doing,
ALTER TABLE TableName RENAME COLUMN OldName TO NewName
but it's not getting..

thanks...
Reply With Quote
  #2 (permalink)  
Old 04-19-04, 09:53
Marcus_A Marcus_A is offline
Registered User
 
Join Date: May 2003
Location: USA
Posts: 5,198
Are you kidding me? You need to download the SQL Reference guide from the IBM website. It is free. There is no such syntax to rename a column.
http://www-306.ibm.com/software/data...s/library.html
__________________
M. A. Feldman
IBM Certified DBA on DB2 for Linux, UNIX, and Windows
IBM Certified DBA on DB2 for z/OS and OS/390
Reply With Quote
  #3 (permalink)  
Old 04-19-04, 15:53
mbourd25 mbourd25 is offline
Registered User
 
Join Date: Mar 2004
Location: Ottawa
Posts: 21
Hi Paren, you'll have to drop the table and redo with the proper column name. If you have some information in the table, before you drop the table you'll have to create a temporary table, insert all the info into that table, drop the old table, create the new tablespace, create the new table with the right column names and column definitions. If you have any, redo any primary and foreign you have. Give grant access to users and then insert all the information from the temporary table.

That's what we have to do here and we are using DB2 version 7.1 for OS/390.
__________________
Mbourd25
Reply With Quote
  #4 (permalink)  
Old 04-20-04, 01:40
Paren Paren is offline
Registered User
 
Join Date: Jan 2004
Posts: 31
thanks a lot Marcus_A and mbourd_d25
Reply With Quote
  #5 (permalink)  
Old 02-18-10, 09:03
abhi_srk abhi_srk is offline
Registered User
 
Join Date: Feb 2010
Posts: 1
Cool Hi

hi folks....im working on DB 9.1 on z/os platform.....

the rename command work for v 9.1..i dunno what versions you are talking about....see my command

ALTER TABLE G31.TG31PDIX RENAME COLUMN RECORD_KEY TO RECORD_KEYY;

DSRZDB2D (s6wbq5) 7:23:43 PM 0:00:00.810 Execution successful ALTER TABLE G31.TG31PDIX RENAME COLUMN RECORD_KEY TO RECORD_KEYY.....
Reply With Quote
  #6 (permalink)  
Old 02-18-10, 09:16
Marcus_A Marcus_A is offline
Registered User
 
Join Date: May 2003
Location: USA
Posts: 5,198
Quote:
Originally Posted by abhi_srk View Post
hi folks....im working on DB 9.1 on z/os platform.....

the rename command work for v 9.1..i dunno what versions you are talking about....see my command
You are responding to posts from May 2004. That is almost 6 years ago.
__________________
M. A. Feldman
IBM Certified DBA on DB2 for Linux, UNIX, and Windows
IBM Certified DBA on DB2 for z/OS and OS/390
Reply With Quote
  #7 (permalink)  
Old 10-27-10, 13:04
hifferyj hifferyj is offline
Registered User
 
Join Date: Oct 2008
Posts: 19
Abhi, thanks. Its good to update old posts so people can find answers on google thereby making this a more popular and successful board.

Marcus, I'm not sure why you're still allowed to post here after your initial response.
Reply With Quote
  #8 (permalink)  
Old 10-27-10, 15:39
Cougar8000 Cougar8000 is offline
Registered User
 
Join Date: Nov 2005
Location: IL
Posts: 554
__________________
--
IBM Certified DBA on DB2 for Linux, UNIX, and Windows

DB2 v9.1.0.2 os 5.3.0.0
Reply With Quote
  #9 (permalink)  
Old 10-27-10, 16:50
Marcus_A Marcus_A is offline
Registered User
 
Join Date: May 2003
Location: USA
Posts: 5,198
Quote:
Originally Posted by hifferyj View Post
Marcus, I'm not sure why you're still allowed to post here after your initial response.
You mean my post from 2004? Because people should check the manual to see if a particular syntax is allowed, instead of just being lazy. If they don't understand the manual or have some question about it (or they could not find the subject in the manual), then it is perfectly fine to ask.

As to why I am allowed to post, it probably has something to do with the fact that (unlike you) I have answered several thousand legitimate questions with very useful information and/or advise.
__________________
M. A. Feldman
IBM Certified DBA on DB2 for Linux, UNIX, and Windows
IBM Certified DBA on DB2 for z/OS and OS/390
Reply With Quote
  #10 (permalink)  
Old 10-27-10, 17:07
hifferyj hifferyj is offline
Registered User
 
Join Date: Oct 2008
Posts: 19
And unlike me, in a great number of them, you've berated people.
Reply With Quote
  #11 (permalink)  
Old 10-27-10, 17:46
Marcus_A Marcus_A is offline
Registered User
 
Join Date: May 2003
Location: USA
Posts: 5,198
Quote:
Originally Posted by hifferyj View Post
And unlike me, in a great number of them, you've berated people.
You mean like you berate me?

I just ask people to be courteous and make an honest effort to read the documentation first and then ask questions. I doubt you have read very many of the more than 4000 questions I have answered, so I don't take your opinion very seriously.
__________________
M. A. Feldman
IBM Certified DBA on DB2 for Linux, UNIX, and Windows
IBM Certified DBA on DB2 for z/OS and OS/390
Reply With Quote
  #12 (permalink)  
Old 10-27-10, 19:47
db2girl db2girl is offline
∞∞∞∞∞∞
 
Join Date: Aug 2008
Location: Toronto, Canada
Posts: 1,816
Quote:
Originally Posted by marcus_a View Post
i have answered several thousand legitimate questions with very useful information and/or advise.
100% .
Reply With Quote
  #13 (permalink)  
Old 10-27-10, 21:44
hifferyj hifferyj is offline
Registered User
 
Join Date: Oct 2008
Posts: 19
Actually, before I initially responded, I clicked on "View All Posts" and witnessed a few instances of your very own brand of courtesy.

Your initial post here was condescending and uncalled for. Granted, it was 6 years ago but your stripes haven't changed all that much.

I didn't berate you. I called you out on something. So if you don't put much stock in my opinions, dig elsewhere and move on . . .
Reply With Quote
  #14 (permalink)  
Old 10-27-10, 22:06
Marcus_A Marcus_A is offline
Registered User
 
Join Date: May 2003
Location: USA
Posts: 5,198
Quote:
Originally Posted by hifferyj View Post
Actually, before I initially responded, I clicked on "View All Posts" and witnessed a few instances of your very own brand of courtesy.

Your initial post here was condescending and uncalled for. Granted, it was 6 years ago but your stripes haven't changed all that much.

I didn't berate you. I called you out on something. So if you don't put much stock in my opinions, dig elsewhere and move on . . .
If someone tries to execute a specific comand such as:

"ALTER TABLE TableName RENAME COLUMN OldName TO NewName"

and it does not work, I don't think it is unreasonable to suggest to that person that they look in manual to see if that is valid syntax.

Maybe you didn't notice, but the original poster in 2004 thanked me for my answer, perhaps because I posted a link to the manuals.
__________________
M. A. Feldman
IBM Certified DBA on DB2 for Linux, UNIX, and Windows
IBM Certified DBA on DB2 for z/OS and OS/390
Reply With Quote
  #15 (permalink)  
Old 10-27-10, 22:42
db2girl db2girl is offline
∞∞∞∞∞∞
 
Join Date: Aug 2008
Location: Toronto, Canada
Posts: 1,816
hifferyj, Let's be "DB2 friends".

Marcus is one of the most knowledgeable DBAs and I'm sure many people are learning a LOT from his posts. I do!
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