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 > how to delete the column having data in the column in EB2

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-09-10, 05:17
arvind.bcamca arvind.bcamca is offline
Registered User
 
Join Date: Feb 2010
Posts: 1
how to delete the column having data in the column in EB2

Can any one help me regarding the deleting the column while having values in that column In DB2.
Reply With Quote
  #2 (permalink)  
Old 02-09-10, 05:31
nvk@vhv nvk@vhv is offline
Registered User
 
Join Date: Jan 2010
Posts: 294
Could you be more specific? What do you want to achieve?
Reply With Quote
  #3 (permalink)  
Old 02-09-10, 05:59
Stealth_DBA Stealth_DBA is offline
Registered User
 
Join Date: May 2009
Posts: 472
If you are using DB2 LUW V9.7, you can use the ALTER TABLE DROP COLUMN command.
If you are using a version of DB2 that does not have this command, you will need to save the data (export / unload) without the column you want to remove, drop the table, create the table without the column, and then put the data back into the table (load / insert).
Reply With Quote
  #4 (permalink)  
Old 02-09-10, 16:55
dav1mo dav1mo is offline
Registered User
 
Join Date: Dec 2007
Location: Richmond, VA
Posts: 782
actually, without being able to spell the name of the database you are working on you should not attempt any of this.
Reply With Quote
  #5 (permalink)  
Old 02-09-10, 17:20
Lenny77 Lenny77 is offline
Registered User
 
Join Date: Jul 2009
Location: NY
Posts: 886
Create the new table having structure you need, and

Insert INTO new_tbl
select <remein colums> from old_tbl;


Lenny
Reply With Quote
  #6 (permalink)  
Old 02-09-10, 17:29
Lenny77 Lenny77 is offline
Registered User
 
Join Date: Jul 2009
Location: NY
Posts: 886
Or (best way) create view from your tables, shown only columns needed to you.

Lenny
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