Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

How to force an Abort upon data condition check Expand / Collapse
Author
Message
Posted Wednesday, December 05, 2012 9:55 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: 2 days ago @ 6:59 PM
Points: 24, Visits: 157

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
Post #1393099
Posted Thursday, December 06, 2012 6:34 AM
Right there with Babe

Right there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with Babe

Group: General Forum Members
Last Login: Yesterday @ 11:10 AM
Points: 740, Visits: 785
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
Post #1393479
Posted Thursday, December 06, 2012 6:59 AM


SSCarpal Tunnel

SSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal Tunnel

Group: General Forum Members
Last Login: Today @ 9:29 AM
Points: 4,240, Visits: 9,487
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:

http://www.sqlservercentral.com/articles/Best+Practices/61537/

If you are asking for help and your post does not contain a question, you should expect responses which do not contain any answers. Put a question mark in there somewhere - it's not rocket science.
Post #1393497
Posted Thursday, December 06, 2012 10:32 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: 2 days ago @ 6:59 PM
Points: 24, Visits: 157
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.
Post #1393642
Posted Thursday, December 06, 2012 11:20 AM


SSCarpal Tunnel

SSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal Tunnel

Group: General Forum Members
Last Login: Today @ 9:29 AM
Points: 4,240, Visits: 9,487
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:

http://www.sqlservercentral.com/articles/Best+Practices/61537/

If you are asking for help and your post does not contain a question, you should expect responses which do not contain any answers. Put a question mark in there somewhere - it's not rocket science.
Post #1393661
Posted Friday, December 07, 2012 9:50 AM
SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Today @ 1:10 PM
Points: 2,673, Visits: 2,418
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.
Post #1394145
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse