Duplicate records in Merge
We are merging according to three columns. 2 of them are Varchar and the last one is Int.
Somehow, due to the integer column, we get duplicate rows, that instead of going to the update, go to the insert.
There are no null values in none of these columns.
When casting this column to varchar, the duplicates don’t get inserted but the cost raise to a number we can’t handle because our dwh table contains a lot of records.