I`m running a Merge query I want to know is there a way after I run this query I can get a resulset which gives me
the columns where the values have been updated? and when not matched what rows got inserted??? I want to use this
as a tracking query??
MERGE into Trg_Persons as a USING (select * from Src_Persons) as t ON a.PersonID = t.PersonID WHEN MATCHED THEN UPDATE set a.PersonID = t.PersonID,a.LastName=t.LastName,a.FirstName=t.FirstName,a.Address=t.Address,a.City=t.City WHEN NOT MATCHED THEN INSERT (PersonID,LastName,FirstName,Address,City) VALUES (PersonID,LastName,FirstName,Address,City); select * from Trg_Persons order by PersonID