Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Dropping a column from a table

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
chagoyal

New User


Joined: 03 May 2007
Posts: 11
Location: India

PostPosted: Tue Sep 25, 2007 1:09 pm    Post subject: Dropping a column from a table
Reply with quote

How can I drop an existing column (non key not null with default) from a table without dropping the table..

Please advice ..!
Back to top
View user's profile Send private message

chagoyal

New User


Joined: 03 May 2007
Posts: 11
Location: India

PostPosted: Tue Sep 25, 2007 1:10 pm    Post subject: Reply to: dropping a column from a table
Reply with quote

I forgot to mention I am using db2 v8.1
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Tue Sep 25, 2007 5:12 pm    Post subject: Re: Dropping a column from a table
Reply with quote

chagoyal wrote:
How can I drop an existing column (non key not null with default) from a table without dropping the table..

Please advice ..!
You can't.
Back to top
View user's profile Send private message
mbr_raja

New User


Joined: 15 Nov 2004
Posts: 26
Location: Chennai, India

PostPosted: Wed Sep 26, 2007 5:21 pm    Post subject: Reply to: Dropping a column from a table
Reply with quote

There is no option to drop a specific column from table. The only option to change the table structure is to drop the specific table and recreate the new table with new definition.
Back to top
View user's profile Send private message
ksk

Active User


Joined: 08 Jun 2006
Posts: 355
Location: New York

PostPosted: Wed Sep 26, 2007 5:49 pm    Post subject: Reply to: Dropping a column from a table
Reply with quote

Hi,

You can't drop a column from the table. If you want to delete a column form the table, DECLARE a new table with all columns except the column that you want to delete and insert the existing data into this new table. And now drop the old table.

Hope this helps.
KSK
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Searching a table for the field name? socker_dad COBOL Programming 8 Sat Mar 31, 2018 2:57 am
No new posts Need inputs on DB2 tablespace/table r... ashek15 DB2 3 Sat Mar 24, 2018 11:49 pm
No new posts Query to compare 2 values of 1 column... Poha Eater DB2 13 Fri Mar 09, 2018 10:45 am
No new posts COBOL declaration for table Poha Eater DB2 3 Mon Feb 26, 2018 6:58 pm
No new posts load and delete table through JCL wit... ram_vizag JCL & VSAM 9 Thu Feb 01, 2018 12:47 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us