tags:

views:

472

answers:

1

What is the syntax to drop multiple columns in DB2? I tried this:

ALTER TABLE work_item DROP COLUMN (TRANSACTION_TYPE, REQUEST_TYPE, LOCATION_CODE, ROLE_ID, SUBMITTED_BY);

But it didn't work. I am running on AIX (from what I read, it looks like maybe you cannot drop columns at all on platforms other than AIX).

If I drop the columns one by one, it seems to work, but after the first three, I need to REORG the table. I want to do this in one fell swoop, with no REORG.

Is it possible?

+1  A: 

The following works for me on DB2 9.5 on Windows, but it should work on earlier versions on AIX as well:

ALTER TABLE MYSCHEMA.ABC
DROP COLUMN B
DROP COLUMN C

Here's the documentation on the ALTER TABLE command

DrJokepu
That did it. Thanks!
pkaeding
pkaeding: Your welcome. DB2 is my favourite database system, it's a shame that I don't get to work with it a lot lately as my current company uses Oracle.
DrJokepu