Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups 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: 356
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 Loading data to table gives wrong for... Raghu navaikulam DB2 19 Thu Jul 13, 2017 2:11 pm
No new posts unload data from table with lob columns farhad_evan DB2 1 Sat Apr 22, 2017 1:32 pm
No new posts Data replication from multiple Db2 ta... kishpra DB2 9 Mon Mar 27, 2017 9:58 pm
No new posts how to send just 10 rows in a CICS sc... Megha Gupta CICS 5 Thu Feb 23, 2017 6:57 pm
No new posts Join of more than one table dibyendumandal11111 DB2 6 Mon Feb 13, 2017 11:36 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us