How to move data from one table to another


I want to move data from one table to another one for example, i have table PurchTable and i want create another Table PurchTableCopy (Duplicate functionality is not allowed for tables participating in table Inheritance) so I create new table PurchTableCopy and i create all field exists in PurchTable except field recID i create field Id) because in the next i want archive data of this table and there is not possible to archive a field recId

So how i can do to move data from PurchTable to PurchTableCopy knowing that there can be adding more fields in the future.

Thank you

What’s your version of AX? You mentioned table inheritance, so it should be some version of AX 2012, right?

Don’t you rather want to use an existing solution for data archivation, such as the Intelligent Data Management Framework?

// Copy data from one dropped table to another
static void CopyData(Args _args)
    SalesTable salesTable ;
    CopySalesTable copyCopySalesTable ;

//start the appends process

   //delete the content if you have any thing inside....
    delete_from copyCopySalesTable ;

    while select salesTable 

        buf2Buf(salesTable , copyCopySalesTable );   
        copyCopySalesTable .insert();

Hi rohit i have a problem.You say “delete the content if you have any thing inside…” .İ dont want to delete .İ want if there is records in inside there will be update.İf there isnt anything in table there will be insert.i want to use like this code.Where table1.ıd != table2.ıd. Think we have in A company there is 10 record and we have in B company where is 7 records. this 3 records must insert and this 7 records must be updated.How can we solve this problem?