Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


How to force an Abort upon data condition check


How to force an Abort upon data condition check

Author
Message
bobd125
bobd125
SSC Rookie
SSC Rookie (25 reputation)SSC Rookie (25 reputation)SSC Rookie (25 reputation)SSC Rookie (25 reputation)SSC Rookie (25 reputation)SSC Rookie (25 reputation)SSC Rookie (25 reputation)SSC Rookie (25 reputation)

Group: General Forum Members
Points: 25 Visits: 179
What is the best way to make your SSIS Data Flow to fail upon a data condition check. What I'm doing is reading a flat file that has both detail records (counting this up) and a single trailer record (that has number of details records sent). If the two values do not match then fail. I'm at the point where I have the two values (total detail records, and trailer detail record count) to compare. I have a derived column ((DT_I8)DETAIL_REC_CNT == (DT_I8)[INT_SENT-REC-SNT] ? TRUE : FALSE
Upon the FALSE I want to Fail (stop the SSIS). I've only written a few SSIS's to date and have never dealt with ERROR path output. Is this how it's handled, and how?

Thank You
robert.gerald.taylor
robert.gerald.taylor
Ten Centuries
Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)

Group: General Forum Members
Points: 1332 Visits: 1399
bobd125 (12/5/2012)

What is the best way to make your SSIS Data Flow to fail upon a data condition check. What I'm doing is reading a flat file that has both detail records (counting this up) and a single trailer record (that has number of details records sent). If the two values do not match then fail. I'm at the point where I have the two values (total detail records, and trailer detail record count) to compare. I have a derived column ((DT_I8)DETAIL_REC_CNT == (DT_I8)[INT_SENT-REC-SNT] ? TRUE : FALSE
Upon the FALSE I want to Fail (stop the SSIS). I've only written a few SSIS's to date and have never dealt with ERROR path output. Is this how it's handled, and how?

It sounds to me like you want to use a Conditional Split transformation. If the counts match, then continue your processing other wise send to another branch where you can log the error (or do whatever else you may need). You wouldn't need the Derived column transformation (unless you need that True/False value somewhere farther down in your processing) using the conditional split.

http://www.bimonkey.com/2009/06/the-conditional-split-transformation/

HTH,
Rob
Phil Parkin
Phil Parkin
SSCrazy Eights
SSCrazy Eights (8.4K reputation)SSCrazy Eights (8.4K reputation)SSCrazy Eights (8.4K reputation)SSCrazy Eights (8.4K reputation)SSCrazy Eights (8.4K reputation)SSCrazy Eights (8.4K reputation)SSCrazy Eights (8.4K reputation)SSCrazy Eights (8.4K reputation)

Group: General Forum Members
Points: 8411 Visits: 19514
robert.gerald.taylor (12/6/2012)
bobd125 (12/5/2012)

What is the best way to make your SSIS Data Flow to fail upon a data condition check. What I'm doing is reading a flat file that has both detail records (counting this up) and a single trailer record (that has number of details records sent). If the two values do not match then fail. I'm at the point where I have the two values (total detail records, and trailer detail record count) to compare. I have a derived column ((DT_I8)DETAIL_REC_CNT == (DT_I8)[INT_SENT-REC-SNT] ? TRUE : FALSE
Upon the FALSE I want to Fail (stop the SSIS). I've only written a few SSIS's to date and have never dealt with ERROR path output. Is this how it's handled, and how?

It sounds to me like you want to use a Conditional Split transformation. If the counts match, then continue your processing other wise send to another branch where you can log the error (or do whatever else you may need). You wouldn't need the Derived column transformation (unless you need that True/False value somewhere farther down in your processing) using the conditional split.

http://www.bimonkey.com/2009/06/the-conditional-split-transformation/

HTH,
Rob


What's ugly about all of this is that you have to read all of the rows & do a check before deciding whether to proceed.

A conditional split is part of your dataflow which (unless you have a clever solution I haven't thought of) would be checked for every input row & would therefore always fail - you don't reach the row containing the count until the very last row.

I'd be tempted to stage what's in the file (just the data rows, not the summary info), then compare the number of rows in this with what the trailer row says & then decide what to do next.


Help us to help you. For better, quicker and more-focused answers to your questions, consider following the advice in this link.

If the answer to your question can be found with a brief Google search, please perform the search yourself, rather than expecting one of the SSC members to do it for you.

Please surround any code or links you post with the appropriate IFCode formatting tags. It helps readability a lot.
bobd125
bobd125
SSC Rookie
SSC Rookie (25 reputation)SSC Rookie (25 reputation)SSC Rookie (25 reputation)SSC Rookie (25 reputation)SSC Rookie (25 reputation)SSC Rookie (25 reputation)SSC Rookie (25 reputation)SSC Rookie (25 reputation)

Group: General Forum Members
Points: 25 Visits: 179
So ignore the Derived Column and just used "((DT_I8)DETAIL_REC_CNT == (DT_I8)[INT_SENT-REC-SNT] ? TRUE : FALSE " is the Conditional Split. And how do I set the Error Output, or default path?. I would like to have the DataFlow stop with an error.
Phil Parkin
Phil Parkin
SSCrazy Eights
SSCrazy Eights (8.4K reputation)SSCrazy Eights (8.4K reputation)SSCrazy Eights (8.4K reputation)SSCrazy Eights (8.4K reputation)SSCrazy Eights (8.4K reputation)SSCrazy Eights (8.4K reputation)SSCrazy Eights (8.4K reputation)SSCrazy Eights (8.4K reputation)

Group: General Forum Members
Points: 8411 Visits: 19514
bobd125 (12/6/2012)
So ignore the Derived Column and just used "((DT_I8)DETAIL_REC_CNT == (DT_I8)[INT_SENT-REC-SNT] ? TRUE : FALSE " is the Conditional Split. And how do I set the Error Output, or default path?. I would like to have the DataFlow stop with an error.


As I alluded in my previous message, there is a fundamental problem with trying to do this all in a data flow. Data flow transformations occur for every row, as they pass through the pipeline.

How can you put a conditional split on row 1 of the data, when you do not yet know the total number of rows in the trailer?

Derived columns are similarly afflicted.

You need a way of reading all rows and doing the check before the rows go anywhere important. That is why I suggested an initial import to a staging table.


Help us to help you. For better, quicker and more-focused answers to your questions, consider following the advice in this link.

If the answer to your question can be found with a brief Google search, please perform the search yourself, rather than expecting one of the SSC members to do it for you.

Please surround any code or links you post with the appropriate IFCode formatting tags. It helps readability a lot.
Daniel Bowlin
Daniel Bowlin
SSCrazy
SSCrazy (3K reputation)SSCrazy (3K reputation)SSCrazy (3K reputation)SSCrazy (3K reputation)SSCrazy (3K reputation)SSCrazy (3K reputation)SSCrazy (3K reputation)SSCrazy (3K reputation)

Group: General Forum Members
Points: 2954 Visits: 2629
Phil is right on target. You have to deal with the entire file before you can evaluate the number of rows. Staging seems like the only solution to me.
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