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 DB2 Table

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
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    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

vini_srcna

Active User


Joined: 26 May 2005
Posts: 178
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: 216
Location: India

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: 178
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: 178
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: 216
Location: India

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: 178
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
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