Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Copy data between two tables using cursor

former_member297013
Discoverer
0 Kudos
213

Hello,

I have two tables in SAP (DB2 database). Table 1 contains 100 fields. Table 2 contains all the fields from Table 1 except 10 fields.

I need to do a straight copy from Table 1 to Table 2 for corresponding fields. I need to copy around 1 billion records. What is the best way to do so. I don't need to read the data in ABAP layer.

Thanks in advance

1 ACCEPTED SOLUTION

raymond_giuseppi
Active Contributor
0 Kudos
69

You should post also in a DB2 forum, for native SQL statements like

  INSERT INTO YOURLIB.TARGET
     (FIELD1, FIELD2, FIELD3, ... FIELD90)
  SELECT FIELD1, FIELD2, FIELD3, ... FIELD90
    FROM YOURLIB.SOURCE

(or create some view on the bigger table with fields of the smaller one to use in the SELECT part)

Else, in Abap, look in forum for samples of parallelization or cursor, calling for insert of batches of records in another task, there are already many samples.

Regards,
Raymond

1 REPLY 1

raymond_giuseppi
Active Contributor
0 Kudos
70

You should post also in a DB2 forum, for native SQL statements like

  INSERT INTO YOURLIB.TARGET
     (FIELD1, FIELD2, FIELD3, ... FIELD90)
  SELECT FIELD1, FIELD2, FIELD3, ... FIELD90
    FROM YOURLIB.SOURCE

(or create some view on the bigger table with fields of the smaller one to use in the SELECT part)

Else, in Abap, look in forum for samples of parallelization or cursor, calling for insert of batches of records in another task, there are already many samples.

Regards,
Raymond