sql - Updating a Type-2 Dimension with the MERGE command -
I'm managing a data warehouse. I have several dimension tables, most of which are type-2 and some type-1.
How can I use MERGE to maintain my Type-1 dimension tables.
I'm stumped on how to type -2 dimension tables.
How do I do both, from ENDDATE update and an insert merge command? Using
merge
, unfortunately, one condition is that you have multiple Do not apply actions, or you operate several times. One line
Then, what I use is a INSERT INTO
wrapping up the merge
:
Insert check DimTable Selection ID, Name, StartDate, Null as EndDate (tgt.id = src.id and Tgt.enddate src on DimTable merge as TGT is used as TgT when the time is set to set tgt.enddate = src. Match not matching in startdate (ID, name, start-up) Val UES (src.id, src.name, src.startdate) Action, src.id, src.Name, src.StartDate) Where a.Action = 'Output $' as the 'Update'
< Rwai P> key OUTPUT
will redirect to the rows in the block so you know that all What a great attribute them, in fact.
Comments
Post a Comment