I am making merge upserts to my data warehouse. I don't need to keep the history on this particular object, so I'm using a type i slowly changing dimension. I'm using OUTPUT $action
so I can keep track of how many updates and inserts occurred per day.
My goal is to skip the logging step for updates where a particular column is updated (age, specifically), because I expect everyone who had a birthday to change ages (I can't include birthdate in the object for privacy). Counting those updates in the logging is undesirable.
So far, my logging is:
OUTPUT $action,
CASE $action
WHEN 'UPDATE' THEN 'Found matching key: updated existing record'
WHEN 'INSERT' THEN 'No matching key: inserted new record'
END
INTO @SummaryOfChanges(Change, Reason)
I want to add logic that says if the column age
is the column updated, then skip the logging step.
Unlike the inserted and deleted parts of $action
, I don't see a way to call back info about the updated rows. I've tried a variety of CASE
statements within the OUTPUT
step, but don't understand how to check if age
was one of the columns updated during the row merge. I can't seem to check if the source and target age
match within the OUTPUT
clause.
Why?