简体   繁体   English

Microsoft SSIS条件拆分无法正常工作

[英]Microsoft SSIS Conditional Split is not working correctly

I need to do the conditional split of data based on the source file record count and process data count if both count match then only i need to perform the insert into DB table but some where my conditional split is failing please find the screen shot and let me know what is wrong 如果两个计数都匹配,我需要根据源文件记录计数和过程数据计数进行有条件的数据拆分,那么仅我需要执行插入数据库表的操作,但是有条件拆分失败的某些情况,请找到屏幕截图并让我知道怎么了

在此处输入图片说明 在此处输入图片说明

Put an expression on the precedence constraint between conditional split and OutputRowCount and put the same expression in there. 将表达式放在条件拆分和OutputRowCount之间的优先约束上,并将相同的表达式放在其中。 Simple fix. 简单修复。

I don't think that you can achieve that within one data flow task , since variables values are committed at the end of Data flow Task execution. 我认为您无法在一个数据流任务中实现这一目标 ,因为变量值是在数据流任务执行结束时提交的。

In your case it will always shows that the row counts are equals since they are both equals to zero. 在您的情况下,它将始终显示行数相等,因为行数均等于零。

You have to create 2 data flow task and one script task: 您必须创建2个数据流任务和一个脚本任务:

  1. First Data Flow Task to get the Original Count and Extracted count and to store them within two variables. 第一个数据流任务,用于获取原始计数和提取计数并将它们存储在两个变量中。
  2. Second Data Flow Task is to import Data into an OLE DB Destination (just a Flat File Source and an OLE DB Destination) 第二个数据流任务是将数据导入OLE DB目标(仅平面文件源和OLE DB目标)
  3. The Script Task is to notify user that the data is Invalid 脚本任务是通知用户数据无效

Add a precedence constraint between the First DFT and the second one. 在第一个DFT和第二个DFT之间添加一个优先级约束。 In addition, add a precedence constraint between the first DFT and the Script Task 此外,在第一个DFT和脚本任务之间添加优先级约束

On each precedence constraint add an expression: 在每个优先约束上添加一个表达式:

Between Data Flow Tasks 在数据流任务之间

@[User:OriginalRowCount] == @[User::ExtractedRowCount]

Between DFT and Script Task 在DFT和脚本任务之间

@[User:OriginalRowCount] != @[User::ExtractedRowCount]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM