View previous topic :: View next topic
|
Author |
Message |
rohanatl
New User
Joined: 21 Oct 2005 Posts: 22
|
|
|
|
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 |
|
|
Varun Singh
New User
Joined: 01 Aug 2007 Posts: 25 Location: Delhi
|
|
|
|
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 |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
you will need to modify the generated LOAD cards, found in the syspunch output of the unload job. |
|
Back to top |
|
|
am_ne
New User
Joined: 24 Mar 2007 Posts: 25 Location: Bangalore
|
|
|
|
In addition to the above you have to specify HEADER option in unload card and it should be HEADER NONE. |
|
Back to top |
|
|
ascelepius
New User
Joined: 16 Jun 2008 Posts: 35 Location: bangalore
|
|
|
|
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 |
|
|
rohanatl
New User
Joined: 21 Oct 2005 Posts: 22
|
|
|
|
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 |
|
|
|