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

Copy selected data from one table to another


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

New User


Joined: 05 Dec 2006
Posts: 83
Location: Bangalore

PostPosted: Tue Jul 17, 2007 11:54 am
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: Canada

PostPosted: Tue Jul 17, 2007 12:43 pm
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: 83
Location: Bangalore

PostPosted: Tue Jul 17, 2007 3:17 pm
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

Moderator Emeritus


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

PostPosted: Tue Jul 17, 2007 7:18 pm
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 All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts Format data from multiple records usi... SYNCSORT 4
No new posts count contained values of several col... DB2 5
No new posts FileAid move data from two files to o... Compuware & Other Tools 5
No new posts Structured Data and Nested Loops via ... COBOL Programming 0
No new posts Alternate key data extracttion COBOL Programming 13
Search our Forums:


Back to Top