简体   繁体   中英

SSIS 2 Conditional Split not working as Expected

I am new to SSIS and was going through a usecase where I want to implement SCD type 2 without using SCD component (that is the requirement) where I have to use more than one conditional split and a Lookup. now when i use a single lookup and single consditional split it is working like a charm but the moment i introduce second conditional split it is not working either way . I have provide dataviwer to see data but it is not showing data also.

can you help me

my data flow is look like this 在此处输入图片说明

still first conditional split everything looking fine but after inserting second and third conditional split its not working.

Remember Occam's razor . Which is more likely, that a product is developed that works with 0 to 1 components but utterly fails with 2 or that your implementation is flawed?

I find that the following situations are most likely to go against expectations which I translate into "I haven't read any documentation and am fumbling my way through the UI". That's not intended as an insult, just an approach many, including myself, employ. The trick of course, is when presented with something that behaves contrary, you then consult the Fine Manual.

High level design issues

Your conditional splits do not account for all the possibilities, therefore you're "losing" data. Something your data flow lacks, is row counts. How many rows did I start with? How many rows have gone to the various sinks/destinations? At the end of the day/data flow, you must be able to account for all the data. If not, then something's gone awry and your data load is invalid.

I'd also pick nits at your lack of useful component names and OLE DB Command objects but that's maintainability and scalability which is premature optimization when the answers are wrong

What's likely the cause

Getting down to brass tacks, I'm willing to wager you are losing data to the following conditions in your data

  • NULL
  • case sensitivity

From your path annotations, your second Conditional Split 1 has 2-3 outputs. Male , Female , and assuming you didn't rename the Default output to Male or Female, Default .

You state you're losing all the data at this split. It's likely that it's all going to the Default output. I expect you have an Expressions in your conditional split like

Male := [GenderColumn] == "Male"
Female := [GenderColumn] == "Female"

However, if your source data contains male, mAle, female, FEMALE and all the permutations inbetween, you're only ever going to match based on a strict case sensitive match, which none of your data has matched. To resolve this, you would want to compare consistent values.

Here I am arbitrarily converting everything to upper case. LOWER works just as well. The important thing is that they need to result in the same value. I'm also lazy in that I'm applying a function to a constant.

Male := UPPER([GenderColumn]) == UPPER("Male")
Female := UPPER([GenderColumn]) == UPPER("Female")

But wait, what if I have NULLs? Great question, wat do? A NULL value is neither Male or Female, how should that data be treated? Right now, it's going down the Default output path. Maybe it should be treated as Male since we have a gender bias in our product. Your business user will likely know what should be done with unknown values so you should consult them. You would then add in an OR condition, via the || and test for whether the current value for our column is NULL

Male := UPPER([GenderColumn]) == UPPER("Male") || ISNULL([GenderColumn])
Female := UPPER([GenderColumn]) == UPPER("Female")

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM