If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > In DB2, Is it possible for us to drop a column from a populated table?

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-25-06, 00:23
murali_rajeev murali_rajeev is offline
Registered User
 
Join Date: Aug 2003
Posts: 15
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
Reply With Quote
  #2 (permalink)  
Old 01-25-06, 01:11
JAYANTA_DATTA JAYANTA_DATTA is offline
Registered User
 
Join Date: Oct 2004
Location: DELHI INDIA
Posts: 336
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
Reply With Quote
  #3 (permalink)  
Old 01-25-06, 01:16
murali_rajeev murali_rajeev is offline
Registered User
 
Join Date: Aug 2003
Posts: 15
Thank you very much Jay for your immediate response.

regards

Rajeev
Reply With Quote
  #4 (permalink)  
Old 01-25-06, 04:37
sathyaram_s sathyaram_s is offline
Super Moderator
 
Join Date: Aug 2001
Location: UK
Posts: 4,534
Using ALTOBJ stored proc is an alternative
__________________
Visit the new-look IDUG Website , register to gain access to the excellent content.
Reply With Quote
  #5 (permalink)  
Old 01-27-06, 14:36
Cougar8000 Cougar8000 is offline
Registered User
 
Join Date: Nov 2005
Location: IL
Posts: 554
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.1.0.2 os 5.3.0.0
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On