Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

SCD type 2 using merge

$
0
0

Hi ,

I'm trying to impliment SCD type 2 using Merge but unlike typical Merge where you have target and source table,  my Inserts come from one table and updates/changes are determined from another table.. I have issue with updates.

below is structure of three tables :

Dimension Table : 

 VQ_id, VQ_name, contact_type, center_node_id, sed_id, eed_id, IsCurrent, insert_date  

VQ_Id is dimension ID based on which Inserts and undates are determined.

VQ_Name : type 1 change

Contact_type , Center_node_ID : type 2 changes

is Current : flag

sed_id , eed_id are start and end effective date ID's

Insert table :

VQ_id,VQ_Name ,Contact_Type , Center_node_ID , Sed_id , eed_id , Insert_date

from the above table, based on VQ_ID , new records are determined .

Updates/history records :

Type 2 changes are tracked based on below table..

VQ_ID, contact_type, center_node_id, Start_Effective_Date, CT_ID, Submit_Date

Based on VQ_ID ,  contact_type, center_node_id, Start_Effective_Date , end effective date are determined.

Any help in this regard is appreciated...

Thanks ,

Vishal.


Viewing all articles
Browse latest Browse all 23857

Trending Articles