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

Copy records between tables in db2


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

New User


Joined: 09 May 2005
Posts: 17

PostPosted: Sun Aug 13, 2006 8:39 pm
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
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: 17

PostPosted: Tue Aug 15, 2006 12:30 pm
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
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: 17

PostPosted: Sat Aug 19, 2006 7:47 pm
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
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 VB to VB copy - Full length reached SYNCSORT 8
Search our Forums:

Back to Top