IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Dropping a column from a table


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
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
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
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
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
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts Replacing 'YYMMDD' with date, varying... SYNCSORT 3
No new posts Load new table with Old unload - DB2 DB2 6
No new posts Pulling a fixed number of records fro... DB2 2
No new posts How to load to DB2 with column level ... DB2 6
No new posts RC query -Time column CA Products 3
Search our Forums:

Back to Top