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 copying data without knowing location arunsoods DFSORT/ICETOOL 6 Thu Jul 20, 2017 1:03 pm
This topic is locked: you cannot edit posts or make replies. Fetching data from BAI File arunsoods JCL & VSAM 1 Wed Jul 19, 2017 4:28 pm
No new posts Loading data to table gives wrong for... Raghu navaikulam DB2 19 Thu Jul 13, 2017 2:11 pm
No new posts SQL - select data available in index Nileshkul DB2 3 Mon Jun 26, 2017 1:30 am
No new posts NDM syntax checking without actually ... GAPX1 All Other Mainframe Topics 0 Wed Jun 07, 2017 2:36 am


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