Results 1 to 5 of 5
  1. #1
    Join Date
    Aug 2003
    Posts
    15

    Unanswered: In DB2, Is it possible for us to drop a column from a populated table?

    Hi Greetings..

    We are using DB2 8.2 on Windows 2000 Server.

    I would like to know In DB2, Is it possible for us to drop a column from a populated table?

    regards

    Rajeev

  2. #2
    Join Date
    Oct 2004
    Location
    DELHI INDIA
    Posts
    338
    No,
    Its not possible.
    what you can do is.
    1> Export the records to a .csv file.
    2> Take out the DDL of the table
    3>Drop the table
    4>Make the required change in the DDL (remove the column)
    5>Open the .csv file in a excel sheet and remove the records for the particular column.
    6> Create the new table with the modified DDl
    7> Import the new .csv file to the table.

    Tx,
    Jay

  3. #3
    Join Date
    Aug 2003
    Posts
    15
    Thank you very much Jay for your immediate response.

    regards

    Rajeev

  4. #4
    Join Date
    Aug 2001
    Location
    UK
    Posts
    4,650
    Using ALTOBJ stored proc is an alternative
    Visit the new-look IDUG Website , register to gain access to the excellent content.

  5. #5
    Join Date
    Nov 2005
    Location
    IL
    Posts
    557
    Jay step is correct, however I am lazy bum and like to skip steps. So, in situation like that I export to ixf only the columns that will need to be in the new table. Then import. It removes the manual work, thus limits on errors.
    --
    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
  •