Consultor Eletrônico



Kbase P22472: How to archive a database table changes in another database?
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   4/1/2003
Status: Unverified

GOAL:

How to archive a database table changes in a target database?

SYMPTOM(s):

Source and target databases have the same schema.

Need to copy records selected based on some criteria from the source database to the target database.

FIX:

One solution is to use the BUFFER-COPY statement as per the following sample where all new customer records in the SourceDB are backed up into the customer table of the TargetDB:

FOR EACH SourceDB.Customer NO-LOCK:
FIND FIRST TargetDB.Customer
WHERE
TargetDB.Customer.Cust-Num = SourceDB.Customer.Cust-Num
NO-ERROR.

IF NOT AVAILABLE (TargetDB.Customer) THEN DO:
CREATE TargetDB.Customer.
BUFFER-COPY SourceDB.Customer TO TargetDB.Customer.
END.
END.