如何配置SSIS软件包以使用未定义的日期运行存储过程,但取决于最后提取

发布于 2025-02-08 21:12:16 字数 1467 浏览 0 评论 0原文

我的任务具有挑战性,对创建SSIS Packahe的最佳方法有些困惑。 基本上,我需要创建一个软件包,该软件包每周发送3次CSV文件,该文件的数据从SQL Server到SFTP文件夹。我的想法是创建一个计划,该作业计划在SSIS软件包中运行3次Pro Week。 该文件中的数据应从上次运行到昨天。 我已经完成的步骤。 1-我创建了一个配置表来注册已发送的文件。

2-我做了一个程序将SQL数据转换为CSV,在此将日期放在这样的参数中:

结果:

”在此处输入图像描述”

3-我正在尝试创建一个软件包,但是我很难说出在包装中运行的商店过程是什么。基本上,当我运行软件包时,必须获得最后加载的日期,并从该日期到昨天运行该过程。我不知道这些日期是否应为包装中的参数或变量以及如何配置该日期。我需要将数据添加到文件名中,例如file_20221010.csv

4-我已经定义了此变量:

和此处的dinamic程序:

,但是有问题,因为它似乎不起作用:

https://i.sstatic.net/cpn37.png“ alt =”在此处输入图像说明”>

I have a challenging task and am a bit confused as to the best approach to create an SSIS packahe.
Basically, I need to create a package that sends three times a week a csv file whose data comes from the sql server to the SFTP folder. My idea is to create a job that will be scheduled to run 3 times pro week the SSIS package.
The data in that file should be from the last run to yesterday.
Steps I have already done.
1- I created a configuration table to register the sent files.
enter image description here

2- I did a procedure to convert sql data into csv, where I put dates as parameters like this:
enter image description here

Result:

enter image description here

3- I'm trying to create a package but I'm having trouble putting the say what are the that the store procedure inside of package need to run. Basically when I run package it has to get the date of the last loaded and run the procedure from that date to yesterday. I don't know if these dates should be as parameters or variables in package and how to configure that. I need to add he data into to the file name like this file_20221010.csv

4- I have defined this variables:
enter image description here

And a dinamic procedure here:
enter image description here

But something wrong because it does not seems to work:

enter image description here

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

扬花落满肩 2025-02-15 21:12:17

分辨率步骤:

  1. 创建一个变量启动日期和结束日期。将当前的DateTime邮票分配到结束日期变量。
  2. 创建执行SQL任务,然后将输出映射到结果设置 - >开始日期变量。
  3. 现在,将开始日期和结束日期变量作为参数映射传递到存储过程执行SQL任务。

另外,您可以使用数据流任务运行查询,并使用Flat File Connection Manager导出到CSV,并编写脚本任务以将文件上传到SFTP。

Resolution Steps:

  1. Create a Variable Start Date and End Date. Assign the current datetime stamp to the End Date variable.
  2. Create a Execute SQL task and map the output to Result Set -> Start Date Variable.
  3. Now pass the Start Date and End Date variables as parameter mapping to the stored procedure Execute SQL Task.

Alternatively, you can run a query using Data Flow Task and export to CSV using Flat file connection manager and write a script task to upload the file to the SFTP.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文