Type 2 SCD with SQL Merge

I was going through some notes I had from previous projects and came across a sample script for created a Type 2 Slow Changing Dimension (SCD) in a database or data warehouse. A Type 2 SCD is one where new records are added, but old ones are marked as archived and then a new row with the change is inserted. …