在 ProcessInputRow 方法中中止对 Row 的处理?

发布于 2024-09-06 19:31:17 字数 367 浏览 1 评论 0 原文

是否可以在 ProcessInputRow 方法中中止对行的处理?我正在使用此函数中传入的 CSV 数据进行一些数据验证。我正在子中设置行值。如果发生错误,我将在 ProcessInputRow 中捕获它并开始将数据写入暂存表以供稍后批准。一切都很好。问题是含有错误数据的行仍然写入目标表中。

例如,我有一行字符串值 99-02-2010,我尝试将其作为 CDate 添加到日期列,如下所示:

Row.ChangeDate = CDate(rowValues.GetValue(0).ToString()) ' =>抛出异常

正如所说,异常是由我通过将行写入临时表来抛出和处理的。但我找不到一种方法来停止通过脚本任务处理这一行。有什么想法吗?

问候

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

瑾兮 2024-09-13 19:31:17

在脚本任务中创建一个新的输出,并将坏行路由到错误输出(添加适当的错误消息列/描述)。然后将它们路由到您想要使用的任何其他表。

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.

苍景流年 2024-09-13 19:31:17

终于成功了。现在它是[1]和[2]的组合。我必须手动将输出行添加到新创建的输出中。然后我能够映射无效行的表。
现在我有一个有效行的输出和一个无效行的输出。我在脚本中分配行数据值并将它们定向到相应的输出。

手动创建所有列有点奇怪。但最终它按预期工作了。如果你知道怎么做就很容易。谢谢您的意见。

[1] http://agilebi.com/cs/blogs/jwelch/archive/2007/05/08/handling-flat-files-with-variing-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

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文