我只是在做SCD 2的工作,但无法完全实现它,因为有些场景没有被完全填满。我在IICS做过。真的很难涵盖所有可能的情况。因此,下面是流程:
Src
---> Lkp ( on src.id = tgt.id)
---> expression ( flag= iif (isnull (tgt.surrogatekey) then Insert, iif(isnotnull(tgt.surrogatekey) and md5(other_non_key_cole)<>tgt.md5)then Update)
----> insert on flag insert(works fine)
but on update i pass updates
to 2 target instances
of same target table
in one i am updating it
as new update as insert
and in other i
am updating tgt_end_date=lkp_start_date for previously stored ids and active_ind becomes 'N'. 但是,当我收到具有相同记录的新更新时,这是可行的,这意味着重复或简单地重新运行目标表中的映射插入重复,而且当我插入相同记录的多个更改时,end_date的更改也会变得不稳定--它将所有active_flags设置为'Y‘,所有预期值都应该是'N’,除非在运行中最后一个是‘N’。如果你能解释的话,即使在SQL中,也有人能帮忙吗?
发布于 2022-11-13 11:08:47
如果我正确理解了您的问题,在每次运行时,您的源中都有多条记录与目标中的单个记录相匹配。
如果是这样的话,那么您需要处理数据,以便在将数据通过SCD2进程之前,每个目标记录都有一个源记录。
https://stackoverflow.com/questions/74416943
复制相似问题