views:

20

answers:

2

Is it possible to abort the processing of a row in the ProcessInputRow method? I'm doing 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

+1  A: 

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.

Cade Roux
That's not really possible. I had to use this [1] workaround for processing my CSV data. Problem here is now that the created output has to be synced to the SynchronousInputId of the input. But my input has only one row as you can see in the blog post. Because of that i can't bind a datatable to the newly created output because i can't map any fields. [1] http://agilebi.com/cs/blogs/jwelch/archive/2007/05/08/handling-flat-files-with-varying-numbers-of-columns.aspx
pantarhei
A: 

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

pantarhei

related questions