捕获数据流中的最大值

Capturing the max value in a data flow

在多年未使用 SSIS 之后,我才重新使用它。这是我需要做的。

1) Read a value from a table and store into a variable
2) Create a data flow where I retrieve some number of rows 
   having a value greater than the value retrieved in #1.
3) Store the rows retrieved in #2 into another table
4) Determine the maximum value of a particular column from the rows 
   read in from step #2 and update the table referenced in #1.

前三个步骤简单、直接且有效。但是,我不确定完成#4 的最佳方法。

最佳总是主观的,但最直接的机制是在您的目的地之前添加多播组件。

多播将允许流经管道的所有数据显示在多个流中。这一切都是通过指向实际数据缓冲区的指针完成的,不会导致散布数据的物理副本。

从多播中,将其连接到聚合组件并对您使用的任何列执行 MAX 操作。

您知道您将只有一行来自此聚合,因此我将使用 OLE DB 命令组件来更新您的 table #1。像

UPDATE ETLStatus
SET MaxValue = ?
WHERE PackageName = ?;

然后您将列名称映射为

MaxValue => Parameter_0
PackageName => Parameter_1