What is the approach to be followed for incremental load of data (includes insert update delete operations)
load data to staging
Then using the merge command do: insert, update, delete
MERGE esqlProductTarget T
USING esqlProductSource S
ON (S.ProductID = T.ProductID)
WHEN MATCHED
THEN UPDATE
SET T.Name = S.Name,
T.ProductNumber = S.ProductNumber,
T.Color = S.Color
WHEN NOT MATCHED BY TARGET
THEN INSERT (ProductID, Name, ProductNumber, Color)
VALUES (S.ProductID, S.Name, S.ProductNumber, S.Color)
WHEN NOT MATCHED BY SOURCE
THEN DELETE;
or use separate DMLs to do each one at a time
insert into table
update tgt
from table tgt
delete from table
where
Another option:
- Select incremental data only from source system
- Delete data from destination that exists (by primary key - unique identifier) in source
- Insert all data from source into destination
You can use other methods - depending on your source data and how it is extracted. For example - you could identify in the source a customer that has had activity and extract all related information for that customer - then perform a delete/insert or merge or version (type 2 change) or something else...