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
 

 

Copy selected data from one table to another

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
Huzefa

New User


Joined: 05 Dec 2006
Posts: 85
Location: Bangalore

PostPosted: Tue Jul 17, 2007 11:54 am    Post subject: Copy selected data from one table to another
Reply with quote

Hi All,

Assume I have a database DB10001. I have a table in this database named CREATOR.TABLE1. This Table has 10 columns.

What I have to achieve is to drop the existing table CREATOR.TABLE1 and recreate the table CREATOR.TABLE1 with 5 columns and with all the records from the dropped tables.

One option is
1. Unload the data
2. drop the table with 10 columns
3. create the table with 5 columns and
4. load the data.

I have more than 155331295 in the database and hence I feel this as a costly affair..

Can anybody give me some other option or solution
Back to top
View user's profile Send private message

muthuvel

Active User


Joined: 29 Nov 2005
Posts: 217
Location: Chennai

PostPosted: Tue Jul 17, 2007 12:43 pm    Post subject: Re: Copy selected dat from on table to another
Reply with quote

From manual says,
Quote:

It is not possible to rearrange or delete columns in a table without dropping the entire table. You can, however, create a view on the table, which includes only the columns you want, in the order you want. This has the same effect as redefining the table
Back to top
View user's profile Send private message
Huzefa

New User


Joined: 05 Dec 2006
Posts: 85
Location: Bangalore

PostPosted: Tue Jul 17, 2007 3:17 pm    Post subject:
Reply with quote

The issue here is not with the accessing of data but to save the DASD space and hence I need to have another table with 5 columns dropping the previous table
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Tue Jul 17, 2007 7:18 pm    Post subject:
Reply with quote

Hello,

Start the unload. . . .

Regardless of other suggestions you may receive, i suggest you will want a complete unload before you do anything else. Even if you have an image copy or volume backup, having the unloaded data is a good precaution. If it it too large for dasd, use cart/tape.

After the unload completes, if there have been no suggestions that will meet your request, do the drop, create, and reload of the selected data.
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 Data replication from multiple Db2 ta... kishpra DB2 5 Mon Mar 27, 2017 9:58 pm
No new posts Export flat file data into excel sheet murali.andaluri DFSORT/ICETOOL 2 Mon Mar 20, 2017 5:39 pm
No new posts Append data from two files into a sin... Praveen04 DFSORT/ICETOOL 5 Thu Mar 16, 2017 7:29 pm
No new posts SPUFI -- Joining 3 tables – data in... Sysaron DB2 2 Wed Mar 08, 2017 4:18 am
No new posts Overriding PS data in rexx Shaheen Shaik CLIST & REXX 8 Fri Mar 03, 2017 5:08 pm


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