Results 1 to 3 of 3
  1. #1
    Join Date
    Jul 2003
    Posts
    16

    Unanswered: question about deleting a table column

    Hi, guys:

    I have DB2/NT 7.2.3 on my Win2000. I am trying to delete a column from a
    table like this:

    ALTER table mytable drop column mycolumn decimal(15)

    it seems I cannot do it.

    Is this because of my version or OS? Os there any way around this?

    thanks a lot

  2. #2
    Join Date
    May 2003
    Location
    USA
    Posts
    5,737
    You cannot delete a column from a table.
    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
    Jan 2003
    Posts
    1,605
    Hi rick_cold,

    Marcus_A is correct, droping column can't be done in db2 7.2 on win2000.

    Work around:
    1. create table without column you don't need. Name the table e.g. db2admin.new
    2. insert records into new table e.g.: insert into db2admin.new (col1, col2) select col1, col2 from db2admin.original
    3. drop (or rename) the original table.
    4. rename table db2admin.new to db2admin.original (command: rename db2admin.new to original)

    Hope this helps,
    Grofaty
    Last edited by grofaty; 01-17-05 at 05:20.

Posting Permissions

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