Sequential update and insert

Six Stars

Sequential update and insert

 

Team,

I have a scenario like below,

Daily i get a source file with many records which I will be updating into a table.

Sample source file is like below,

EMPID,NAME,SALARY
100,Raj,1000
100,Raj,2000
200,Ram,3000
200,Ram,4000
300,Peter,5000
400,Anto,6000

Whenever I have two records for a particular EMPID, first I should update the date column of already existing record for that EMPID and then insert the first record with salary change,
then next step again update the second record inserted and insert the third record.

Find below the before and after status of table,

 

Table before any insert or update :

EMP ID

NAME

SALARY

UPDATE DATE

100

Raj

500

31-Dec-99

 

Table after the update1, insert1, update2, insert2 :

 

EMP ID

NAME

SALARY

UPDATE DATE

100

Raj

500

26-Aug-17

100

Raj

1000

27-Aug-17

100

Raj

2000

31-Dec-99

 

The update/insert key is EMPID.

Please help!

Eight Stars sgv
Eight Stars

Re: Sequential update and insert

Hi ,

So it's not really and update.... it's more like an insert but your PK is EMPID + UPDATE_DATE. You can do it like that : just add in your update/insert key the UPDATE_DATE column

 

Or else, you can take information about SCD (Slowing Changing Dimension), and use an SCD component Smiley Wink

 

Good luck ,

SGV

Calling Talend Open Studio Users

The first 100 community members completing the Open Studio survey win a $10 gift voucher.

Start the survey

2019 GARNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

Best Practices for Using Context Variables with Talend – Part 4

Pick up some tips and tricks with Context Variables

Blog

How Media Organizations Achieved Success with Data Integration

Learn how media organizations have achieved success with Data Integration

Read

Downloads and Trials

Test drive Talend's enterprise products.

Downloads