SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Recording why a change happened using MERGE with Type 2 SCD


Recording why a change happened using MERGE with Type 2 SCD

Author
Message
ps_vbdev
ps_vbdev
SSCommitted
SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)

Group: General Forum Members
Points: 1557 Visits: 726
I have a few fields in my staging DimProducts that are type 2 scd. I've got my merge statement up and run after a little bit of confusion.

Is it possible/necessary to track why a scd occurred or should we just be concerned with the audit trail i.e.

"these are the old records for this product, this is the new active record, they old ones could have been retired for three reasons,but i don't care why they just did!!!"

I was originally included the three status in my dim (product active, color active, size active) and it was confusing me as the merge wasn't updating them as i expected.

Thanks.
JustMarie
JustMarie
Hall of Fame
Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)

Group: General Forum Members
Points: 3142 Visits: 1378
I'm not sure how you define "why something changed". That sounds more like a business rule.
Lempster
Lempster
SSCertifiable
SSCertifiable (7K reputation)SSCertifiable (7K reputation)SSCertifiable (7K reputation)SSCertifiable (7K reputation)SSCertifiable (7K reputation)SSCertifiable (7K reputation)SSCertifiable (7K reputation)SSCertifiable (7K reputation)

Group: General Forum Members
Points: 7039 Visits: 1659
Do you mean why something changed from a business perspective or from a logical perspective? Using Lookup and Conditional Split transforms it's quite easy to track whether column values have been Inserted, Updated or Deleted and then you could populate a 'ReasonForChange' column accordingly. If it's the business reason for change that you want to capture, that would likely need to come from the source system, otherwise you'd just be guessing I'd have thought.

Regards
Lempster
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search