如何将返回多个结果集的SP的最后一个结果集保存到SSIS中的临时table中?

How to save the last result set of SP which is returning multiple result sets into a temp table in SSIS?

我有一个存储过程:myProcedure 最后返回 2 个不同的结果集,如:

select * from #alldata where <condition1>

select * from #allData where <condition2>

请注意我不能修改SP。

我需要的是获取从 SP 返回的第二个(最后一个)结果集并将其保存在 SSIS 2012 中的临时 table 中。

我设法做到的是使用包含以下行的脚本任务:

DataSet ds = db.ExecStoredProcedureDataSet("[myProcedure]", sqlFilters).Tables[1];

我想知道是否有一种方法可以通过使用 "Execute SQL Task" 来处理它。

当我查看下面的主题时,似乎 SP 只返回一个结果集是可能的,但在我的情况下找不到方法,SP returns 多个结果集,我需要最后一个仅保存在临时 table 中。任何帮助将不胜感激。

Insert results of a stored procedure into a temporary table

编辑:它与指定主题不重复,我需要一个可以在 SSIS 控制流中执行 SQL 任务流程的解决方案。

来自the docs

If the Execute SQL task uses the Full result set result set and the query returns multiple rowsets, the task returns only the first rowset. If this rowset generates an error, the task reports the error. If other rowsets generate errors, the task does not report them.

因此,SSIS 执行 SQL 任务无法从单个过程访问多个结果集。只能访问第一个。