Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Copy records between tables in db2

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

New User


Joined: 09 May 2005
Posts: 18

PostPosted: Sun Aug 13, 2006 8:39 pm    Post subject: Copy records between tables in db2
Reply with quote

Hello

I need one immediate help from any of u guys.

I'm using db2 on mainframe.

I need to copy some records between 2 tables among which 1st table having 20 fields and the second having 25.

and in both tables name and some other fields are common. Name field which was declared as character(70) in the first table having data like a, b, c,..abc1,abc2,abc3..abc15,x,y,z.

I want to copy records from 1st table to 2nd table with the condition that only records having name between abc1 to abc15 has to be copied.

can i use file-aid or file-aid for db2 tools or is it possible thru some sql query? if its possible thru sql query, plz send me the query. plz help me asap.

Kiran
Back to top
View user's profile Send private message

DavidatK

Active Member


Joined: 22 Nov 2005
Posts: 700
Location: Troy, Michigan USA

PostPosted: Mon Aug 14, 2006 8:43 pm    Post subject: Re: Copy records between tables in db2
Reply with quote

Code:

INSERT
  INTO DB2.TABLE2
    (COL1,
     COL2,
     COL3,
     :
     COL20,
     COL21,
     :
     COL25
     )
SELECT
    (COL1,
     COL2,
     COL3,
     :
     COL20,
     value21,
     :
     value23
     )
  FROM DB2.TABLE1
 WHERE NAME BETWEEN ?abc1? and ?abc15?
;


Dave
Back to top
View user's profile Send private message
komal

New User


Joined: 09 May 2005
Posts: 18

PostPosted: Tue Aug 15, 2006 12:30 pm    Post subject: thanq
Reply with quote

hi david thanks for ur reply.

Is there any possiblity to do the same from fileaid for db2?
Back to top
View user's profile Send private message
Knowledge Hunter

New User


Joined: 17 Aug 2006
Posts: 22
Location: India

PostPosted: Sat Aug 19, 2006 1:17 am    Post subject:
Reply with quote

hi komal,

I guess you can achieve this using fileaid for db2 also. Try using

3 - utilities ; 3 - copy
and give column matching as 'No'

Thanks & Regards,
Knowledge Hunter
Back to top
View user's profile Send private message
komal

New User


Joined: 09 May 2005
Posts: 18

PostPosted: Sat Aug 19, 2006 7:47 pm    Post subject:
Reply with quote

Thanq for ur reply i'll check it out
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 Copy 4 byte of data from the last rec... arunsoods DFSORT/ICETOOL 9 Fri Oct 06, 2017 12:15 pm
No new posts sort records based on length exceeds ... maxsubrat DFSORT/ICETOOL 7 Wed Oct 04, 2017 4:48 pm
No new posts Addition of two records on 2 fields amar143 SYNCSORT 8 Tue Oct 03, 2017 11:14 am
No new posts XMITIP sends it out. Can it copy on l... Rommel Dayon Rustia IBM Tools 0 Tue Sep 05, 2017 10:16 am
No new posts Join records from 2 files with No Dup... Poha Eater DFSORT/ICETOOL 22 Sun Aug 27, 2017 10:35 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us