Skip to Content
avatar image
Former Member

Copy data between two tables using cursor

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    Nov 18, 2016 at 01:02 PM

    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

    Add comment
    10|10000 characters needed characters exceeded