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

Dropping a Column from DB2 Table


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
kutty.r

New User


Joined: 22 Jun 2006
Posts: 24

PostPosted: Mon Aug 04, 2008 2:59 pm
Reply with quote

Hi All,

I need to remove a column from the database table .I am am trying to execute the below mentioned query and ending with an error
SQLSTATE :42601

ALTER TABLE D$TEST.ETEGTTTT DROP COLUMN TTTT_DROP;

Note: could you please suggest any other query for removing a column from DB2 tables?

Thanks!
Back to top
View user's profile Send private message
vini_srcna

Active User


Joined: 26 May 2005
Posts: 178
Location: Copenhagen, Denmark

PostPosted: Mon Aug 04, 2008 4:13 pm
Reply with quote

Drop the table and recreate it without that column. Make sure the you unload the data before dropping it. You can later load the data.
Back to top
View user's profile Send private message
sri_mf

Active User


Joined: 31 Aug 2006
Posts: 218
Location: India

PostPosted: Tue Aug 05, 2008 10:35 am
Reply with quote

vini_srcna wrote:
Drop the table and recreate it without that column. Make sure the you unload the data before dropping it. You can later load the data.


Vini,
I think this is what you mean.

1.Unload the file.
2.Reformat the unloaded file.
3.Use the New reformatted file for loading the New table.


Correct me if i misunderstand you.
Back to top
View user's profile Send private message
vini_srcna

Active User


Joined: 26 May 2005
Posts: 178
Location: Copenhagen, Denmark

PostPosted: Tue Aug 05, 2008 1:27 pm
Reply with quote

Sri,

You have got it right.!. I would do

1. Unload the data into a file without that column. In the SQL query I would not give the column name that needs to be dropped. This way we dont need to reformat the data.
2. Drop the table and recreate it.
3. Load the data.
Back to top
View user's profile Send private message
vini_srcna

Active User


Joined: 26 May 2005
Posts: 178
Location: Copenhagen, Denmark

PostPosted: Tue Aug 05, 2008 1:28 pm
Reply with quote

Ofcourse there are very good tools that they do all this process by themselves. All you have to do is to issue few commands.
Back to top
View user's profile Send private message
sri_mf

Active User


Joined: 31 Aug 2006
Posts: 218
Location: India

PostPosted: Tue Aug 05, 2008 2:32 pm
Reply with quote

vini_srcna wrote:
Ofcourse there are very good tools that they do all this process by themselves. All you have to do is to issue few commands.


Thank you Vini icon_biggrin.gif
Back to top
View user's profile Send private message
vini_srcna

Active User


Joined: 26 May 2005
Posts: 178
Location: Copenhagen, Denmark

PostPosted: Tue Aug 05, 2008 3:56 pm
Reply with quote

You are welcome.
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