Abort processing of Row in ProcessInputRow method?
Is it possible to abort the processing of a row in the ProcessInputRow method? I'm doi开发者_运维技巧ng some data validations with the incoming CSV data in this function. I'm setting the row values in a sub. If an error occurs i'll catch it in the ProcessInputRow and start writing the data into a staging table for a later approval. Everthing works fine. Problem is that the Row with the bad data is still written in the target table.
E.g. i have a row with a string value 99-02-2010 that i try to add as CDate to a date colum like this:
Row.ChangeDate = CDate(rowValues.GetValue(0).ToString()) ' => throws an exception
As is said the exception is thrown and processed by me by writing the row into my staging table. But i can't find a way to stop processing this row by the script task. Any ideas?
regards
Create a new output in your script task and route the bad rows to the error output (with the addition of an appropriate error message column/description). Then route those to whatever other table you want to use.
Finally managed it. It's now a combination of [1] and [2]. I had to add the output rows by hand to my newly created output. Then i was able to map the table for the invalid rows. Now i have a output for valid and one for invalid rows. I'm assigning the row data values in the script and direct them to the according output.
It's a bit odd to crate all the columns by hand. But finally it's working as it should. Easy if you know how. Thx for your input.
[1] http://agilebi.com/cs/blogs/jwelch/archive/2007/05/08/handling-flat-files-with-varying-numbers-of-columns.aspx
[2] http://consultingblogs.emc.com/jamiethomson/archive/2005/09/05/SSIS-Nugget_3A00_-Multiple-outputs-from-a-synchronous-script-transform.aspx
精彩评论