Results 1 to 11 of 11
  1. #1
    Join Date
    May 2009
    Posts
    6

    Red face Unanswered: problem with alter table command

    I am trying to drop a column from the table ASSOCIATED_PAGE_QUESTION and I give the following command
    ALTER TABLE ASSOCIATED_PAGE_QUESTION DROP COLUMN question_name

    There are no constrains associated to this column however this gives me the following error

    ALTER TABLE ASSOCIATED_PAGE_QUESTION DROP COLUMN question_name
    DB21034E The command was processed as an SQL statement because it was not a
    valid Command Line Processor command. During SQL processing it returned:
    SQL0104N An unexpected token "COLUMN" was found following "D_PAGE_QUESTION
    DROP". Expected tokens may include: "CONSTRAINT". SQLSTATE=42601

    Can someone help me out

  2. #2
    Join Date
    Jan 2003
    Posts
    4,292
    Provided Answers: 5
    What DB2 version and OS?

    Andy

  3. #3
    Join Date
    May 2009
    Posts
    6
    Thanks for responding Andy,
    its IBM DB2 Universal Database 8 FP 6a

  4. #4
    Join Date
    May 2009
    Posts
    6
    and the OS is AIX 5.3

  5. #5
    Join Date
    Jan 2003
    Posts
    4,292
    Provided Answers: 5
    ALTER TABLE ... DROP COLUMN is a new feature starting at V 9.1.

    That is why you are getting the error.

    Andy

  6. #6
    Join Date
    May 2009
    Posts
    6
    Ohh thanks .. so is there an alternative way to do this? I am searching online as well

  7. #7
    Join Date
    May 2009
    Posts
    6
    also is there a way to rename a column?

  8. #8
    Join Date
    Nov 2005
    Location
    IL
    Posts
    557
    1. drop and rebuild the table

    2. create a view to rename this column

    3. upgrade
    --
    IBM Certified DBA on DB2 for Linux, UNIX, and Windows

    DB2 v9.7.0.6 os 6.1.0.0

  9. #9
    Join Date
    Aug 2008
    Location
    Toronto, Canada
    Posts
    2,367
    There is altobj that you can use to drop/rename the column, but I believe it's only available starting with v8 fp7:
    DB2 Universal Database

    altojb has some problems so consider upgrading to the latest fixpak if you're going to use it.

  10. #10
    Join Date
    May 2009
    Posts
    6
    Thanks for all ur inputs.. I got the DBA to drop the table and create a newone.

  11. #11
    Join Date
    Nov 2005
    Location
    IL
    Posts
    557
    Quote Originally Posted by abishek.n
    Thanks for all ur inputs.. I got the DBA to drop the table and create a newone.
    Did you get him a doughnut? It will help you in the future
    --
    IBM Certified DBA on DB2 for Linux, UNIX, and Windows

    DB2 v9.7.0.6 os 6.1.0.0

Posting Permissions

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