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 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 Check if any Detail records and extra... V S Amarendra Reddy SYNCSORT 19 Mon May 08, 2017 8:54 pm
No new posts copy SEQ to PDS and create stats steve-myers JCL & VSAM 5 Thu Apr 27, 2017 1:15 am
No new posts Copy load modules and alias vasanthz IBM Tools 5 Thu Apr 20, 2017 6:31 am
No new posts Data replication from multiple Db2 ta... kishpra DB2 9 Mon Mar 27, 2017 9:58 pm
No new posts Join giving more records than expected Danielle.Filteau SYNCSORT 2 Thu Mar 09, 2017 3:28 am


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