Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi All,
I need to perform increment load by using primary key.
I have 2 tables as below
Table1:
Id Name
1 jhon
2 Sam
Table2:
1 Carry
3 Hales
Now required output should be like below
1 Carry-----Updated record
2 Sam
3 Hales------newly inserted record
I followed below script but its not giving expected result:
ExistingData:
LOAD
ID,
Name
FROM [lib://AttachedFiles/ExistingData.qvd]
(qvd);
MaxIDTable:
Load Max(ID) as MaxID Resident ExistingData;
Let MaxID=peek('MaxID', 0, 'MaxIDTable');
Drop table ExistingData;
Incremental_Load:
LOAD
ID, Name
FROM [lib://AttachedFiles/Data.xlsx] (ooxml, embedded labels, table is QVD2) where ID> $(MaxID);
Concatenate
LOAD
ID,
Name
FROM [lib://AttachedFiles/ExistingData.qvd] (qvd)where not Exists(ID);
STORE Incremental Load INTO [lib://AttachedFiles/ExistingData.qvd];
Drop Table Incremental Load;
Drop Table MaxIDTable;
Data:
LOAD
ID, Name
FROM [lib://AttachedFiles/ExistingData.qvd]
Could anyone please help me to get this resolved using insert & updated method.
Thanks in advance