Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.
WITH ctePL AS ( SELECT m.Matters, mp.AssignedPercent, p.Initials, hbm.Matter_Uno, mp.AssignedType, hbmp.Empl_Uno, (SELECT TOP 1 ADRT FROM tbl_ADRAssignedType WHERE ProLaw = mp.AssignedType) AS adAssignedType FROM Source.matters m JOIN Source.MattersProfessionals mp on m.Matters= mp.Matters JOIN Source.Professionals p ON mp.Professionals = p.Professionals JOIN Target.HBM_Matter hbm ON hbm._ProLaw_FK = m.Matters JOIN Target.HBM_PERSNL hbmp ON hbmp.Initials = p.Initials ) MERGE Target.TBM_CLMAT_PART AS Target USING ctePL AS Source ON Target.Matter_Uno = Source.Matter_Uno AND Target.Part_Cat_Code = Source.AssignedType AND Target.Empl_Uno = Source.Empl_Uno WHEN NOT MATCHED BY TARGET THEN INSERT (Row_Uno, Rec_Type, Matter_Uno, Client_Uno, Part_Cat_Code, Eff_Date, To_Date, Empl_Uno, Percentage, Last_Modified) VALUES ((SELECT LastKey + 1 FROM Target.CMS_UNIQUE_KEYS WHERE TBNAME = 'TBM_CLMAT_PART'), '1', Source.Matter_Uno, '0', Source.adAssignedType, '2014-02-06 00:00:00.000', '2099-12-31 00:00:00.000', Source.Empl_Uno, 100, '2014-02-06 00:00:00.000') WHEN MATCHED THEN UPDATE SET Target.Percentage = Source.AssignedPercent WHEN NOT MATCHED BY SOURCE AND Target.Matter_Uno = Source.Matter_Uno THEN DELETE;
Add your voice to the tech community where 5M+ people just like you are talking about what matters.
Join the community of 500,000 technology professionals and ask your questions.