Portal | IBM Manuals | Downloads | Products | Refer | Info | Programs | JCLs | Forum Rules*| Site Map | Mainframe CD 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index
 
Register
 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index FAQ Search Memberlist Usergroups Profile Log in to check your private messages Log in
 
Dropping a Column from DB2 Table

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
Author Message
kutty.r

New User


Joined: 22 Jun 2006
Posts: 24

PostPosted: Mon Aug 04, 2008 2:59 pm    Post subject: Dropping a Column from DB2 Table
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
References
vini_srcna

Active User


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

PostPosted: Mon Aug 04, 2008 4:13 pm    Post subject:
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: 206
Location: At my Desk

PostPosted: Tue Aug 05, 2008 10:35 am    Post subject:
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: 187
Location: Copenhagen, Denmark

PostPosted: Tue Aug 05, 2008 1:27 pm    Post subject:
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: 187
Location: Copenhagen, Denmark

PostPosted: Tue Aug 05, 2008 1:28 pm    Post subject:
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: 206
Location: At my Desk

PostPosted: Tue Aug 05, 2008 2:32 pm    Post subject:
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: 187
Location: Copenhagen, Denmark

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

You are welcome.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1