Page 1 of 2 12 LastLast
Results 1 to 15 of 26
  1. #1
    Join Date
    Jan 2004
    Posts
    31

    Unanswered: 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...

  2. #2
    Join Date
    May 2003
    Location
    USA
    Posts
    5,737
    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

  3. #3
    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

  4. #4
    Join Date
    Jan 2004
    Posts
    31
    thanks a lot Marcus_A and mbourd_d25

  5. #5
    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.....

  6. #6
    Join Date
    May 2003
    Location
    USA
    Posts
    5,737
    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

  7. #7
    Join Date
    Oct 2008
    Posts
    23
    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.

  8. #8
    Join Date
    Nov 2005
    Location
    IL
    Posts
    557
    --
    IBM Certified DBA on DB2 for Linux, UNIX, and Windows

    DB2 v9.7.0.6 os 6.1.0.0

  9. #9
    Join Date
    May 2003
    Location
    USA
    Posts
    5,737
    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

  10. #10
    Join Date
    Oct 2008
    Posts
    23
    And unlike me, in a great number of them, you've berated people.

  11. #11
    Join Date
    May 2003
    Location
    USA
    Posts
    5,737
    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

  12. #12
    Join Date
    Aug 2008
    Location
    Toronto, Canada
    Posts
    2,367
    Quote Originally Posted by marcus_a View Post
    i have answered several thousand legitimate questions with very useful information and/or advise.
    100% .

  13. #13
    Join Date
    Oct 2008
    Posts
    23
    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 . . .

  14. #14
    Join Date
    May 2003
    Location
    USA
    Posts
    5,737
    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

  15. #15
    Join Date
    Aug 2008
    Location
    Toronto, Canada
    Posts
    2,367
    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!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •