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

Loading a table records from another db2 table


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

New User


Joined: 21 Oct 2005
Posts: 22

PostPosted: Tue Jun 17, 2008 12:41 pm
Reply with quote

Hi All,

I need to load a table with some records which is from another db2 table,
I am planing to do the same using an unload utility which will download the records for me and in the next step i will use a load utility to load to second table. I dont want all the columns and i will be specifying a condition so that i will get only the needed records.
Can any one tell me is this is the correct method to try or can i give a query in jcl which will select the rows based on the conditin and inserts to the table
a query some thng like
INSERT INTO TABLE1(SELECT * FROM TABLE2)

is there any drawbacks in the second approch ,

Thanks in advance
Back to top
View user's profile Send private message
Varun Singh

New User


Joined: 01 Aug 2007
Posts: 25
Location: Delhi

PostPosted: Tue Jun 17, 2008 1:20 pm
Reply with quote

I don't think the second approach will work as I do not know any utility which accepts subquery's
anyways what I will suggest you to stick to the first approach

First unload the records from DB2 tables with the concerned columns that you want and
then try loading them to a different table
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Tue Jun 17, 2008 1:53 pm
Reply with quote

you will need to modify the generated LOAD cards, found in the syspunch output of the unload job.
Back to top
View user's profile Send private message
am_ne

New User


Joined: 24 Mar 2007
Posts: 25
Location: Bangalore

PostPosted: Tue Jun 17, 2008 2:26 pm
Reply with quote

In addition to the above you have to specify HEADER option in unload card and it should be HEADER NONE.
Back to top
View user's profile Send private message
ascelepius

New User


Joined: 16 Jun 2008
Posts: 35
Location: bangalore

PostPosted: Tue Jun 17, 2008 3:47 pm
Reply with quote

As most DBAs would say, your answer is "It Depends"!

Case A. If you are loading a small volume of data(say about 100-1000, which should be safe), I'd think- why go for the trouble of Unload and Load, running a simple

Code:

INSERT INTO TABLE1 (Col1, COl2...ColN) SELECT col1, Col2,..ColN from TABLE2 where ...


would do.

Case B. You have a hundred thousand records to insert, then you could follow the unload strategy, since too many DB2 resources get used up in Case A.

Hope this helps..

regards,
ASCI(I)
Back to top
View user's profile Send private message
rohanatl

New User


Joined: 21 Oct 2005
Posts: 22

PostPosted: Tue Jun 17, 2008 4:45 pm
Reply with quote

Hi Thanks a lot for your quick response..
I will be having a huge amount of data to insert so i think i should follow the second option.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts Load new table with Old unload - DB2 DB2 6
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Pulling a fixed number of records fro... DB2 2
No new posts Multiple table unload using INZUTILB DB2 2
No new posts Check data with Exception Table DB2 0
Search our Forums:

Back to Top