2

Assume the following scenario:

All data are in Sql Server tables.

1) An Execute SQL Task to determine if there are records to process by running a select against Table1.

2) If there are, an Execute SQL Task to truncate Table2.

3) A Data-flow task to Load Table2 with the results from the select against Table1.

Now, I can do that easily in a stored procedure, but am required to do it in SSIS.

So far, in the control flow, I've run my select and stored the results in a table variable, lets call it @ResultSet, and just for good measure, I have also created an object-type variable, let's call it MyResults also holding the resultset.

To avoid truncation of Table2 if @ResultSet is empty, I then count the number of records in @ResultSet and raise an error if the count is zero, effectively aborting the package.

Normally this is not the case, and instead of starting my Data-flow by running the same query against Table1 all over again, I would now like to access either my @ResultSet or my MyResults object like any other data source.

The latter should be possible using a scripting task, but I really, really don't want to go down that road.

Whether I can use my @ResultSet or come up with an entirely different approach due to your input, that is the question.

TIA.

4

1 回答 1

0

我相信您的问题与这个问题直接相关:SSIS 在控制流任务之间传递数据源 您确实可以将数据从一个数据流传递到数据集中的另一个数据流,或者通过原始文件。不过,您可以自行检查哪种情况更好

于 2012-06-21T14:52:10.387 回答