You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

DTS中如何实现存储过程游标循环时触发数据流任务分批生成文件

DTSX: How to Trigger Data Flow Task to Generate Files on Each Cursor Loop Iteration in Stored Procedure

Hey everyone, I'm new to DTS/DTSX and currently stuck on a technical issue that I haven't been able to find an exact solution for. I previously referenced a similar question, SSIS : how to run stored procedure in Data Flow Task, but it doesn't fully align with my requirements.

My Requirements

  • Whenever my stored procedure outputs a new rowset to a staging table via cursor loop, I need to trigger a Destination File task to generate a text file.
  • Before writing each new rowset, the previous rowset in the staging table should be deleted, so I can split a large dataset into manageable smaller files.

What I've Done So Far

  • I've used a counter to adjust rowset output, and the stored procedure runs perfectly in an Execute SQL Task—it can loop and load the target rowsets as expected.
  • The Problem: The Data Flow Task + Destination File task chain only outputs the rowset from the last iteration of the cursor loop. It won't trigger to generate a file on each loop.
  • I tried wrapping the Data Flow Task in a For-Each Loop Task, but that didn't work. The For-Each still waits for the stored procedure in the Execute SQL Task to finish completely before processing, so it only picks up the final rowset.

What I Need Help With

I need a way to either:

  1. Trigger the Data Flow/File Destination task on each iteration of the stored procedure's cursor loop, or
  2. Make the Data Flow/File Destination task detect when a new rowset exists in the staging table, generate the file, then clean up the previous rowset from the staging table.

Everything else in my package works fine—I just can't get the file generation to happen per cursor loop iteration. Any feasible solutions would be greatly appreciated!

内容的提问来源于stack exchange,提问作者Techwork999

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.29 22:53:11