Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
AhmedShalaby
New Member

SCD Type 2 in ADF only works when update sink runs before insert sink — why?

Hi everyone,

I'm implementing Slowly Changing Dimension Type 2 (SCD2) in Azure Data Factory using two sinks:

  • One for updating existing records (setting IsActive = 0 when changes are detected)

  • One for inserting new records (with IsActive = 1 and new hash value).

I noticed that the pipeline only works correctly if I run the update sink first and then the insert sink.
If I run the insert sink first, both old and new rows end up having IsActive = 1.

Can someone please explain why the order of sinks matters in this case?

 

Thank you 

1 ACCEPTED SOLUTION
tayloramy
Community Champion
Community Champion

Hi @AhmedShalaby

 

When you run the insert sink first, you create the new "current" row (IsActive = 1) before your update sink tries to retire the old one. Most SCD2 update predicates look for the active row for that business key whose attributes differ. After the insert has happened, the row that is “active” and matches the source hash is the new row, so the update sink no longer finds the old row to set IsActive = 0. That’s why both rows remain IsActive = 1 unless you do the update step first. 

 

If you found this helpful, consider giving some Kudos. If I answered your question or solved your problem, mark this post as the solution.

View solution in original post

3 REPLIES 3
tayloramy
Community Champion
Community Champion

Hi @AhmedShalaby

 

When you run the insert sink first, you create the new "current" row (IsActive = 1) before your update sink tries to retire the old one. Most SCD2 update predicates look for the active row for that business key whose attributes differ. After the insert has happened, the row that is “active” and matches the source hash is the new row, so the update sink no longer finds the old row to set IsActive = 0. That’s why both rows remain IsActive = 1 unless you do the update step first. 

 

If you found this helpful, consider giving some Kudos. If I answered your question or solved your problem, mark this post as the solution.

Hi @AhmedShalaby ,
Thanks for reaching out to the Microsoft fabric community forum.

I would also take a moment to thank @tayloramy   , for actively participating in the community forum and for the solutions you’ve been sharing in the community forum. Your contributions make a real difference. 
I hope the above details help you fix the issue. If you still have any questions or need more help, feel free to reach out. We’re always here to support you.
 

Regards,
Microsoft Fabric Community Support Team.

Hi @AhmedShalaby ,

I hope the above details help you fix the issue. If you still have any questions or need more help, feel free to reach out. We’re always here to support you.
 

Regards,
Microsoft Fabric Community Support Team.

Helpful resources

Announcements
November Fabric Update Carousel

Fabric Monthly Update - November 2025

Check out the November 2025 Fabric update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors