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 > question about deleting a table column

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-15-05, 12:36
rick_cold rick_cold is offline
Registered User
 
Join Date: Jul 2003
Posts: 16
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
Reply With Quote
  #2 (permalink)  
Old 01-15-05, 13:13
Marcus_A Marcus_A is offline
Registered User
 
Join Date: May 2003
Location: USA
Posts: 5,196
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
Reply With Quote
  #3 (permalink)  
Old 01-17-05, 04:18
grofaty grofaty is offline
Registered User
 
Join Date: Jan 2003
Posts: 1,570
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 04:20.
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