将SQL查询的文件夹导出到SSIS中的CSV中

发布于 2025-02-08 00:45:38 字数 467 浏览 2 评论 0原文

我是SSIS的新手,目前正在努力执行SQL任务将结果保存在结果集中,并使用数据流任务将每个表导出到相应的CSV。

有15个.sql存储在文件夹中的文件,我正在创建一个名为folderPath的变量,指向它们。然后,我为每个容器创建一个从文件夹读取并在变量映射中创建一个变量,该变量称为sqlfile

for-each容器中,我有一个执行SQL任务,我更改了文件连接变量,并将表达式编辑为folderpath + sqlfile

当结果设置值设置为无。现在,我试图将数据流任务中从该循环创建的表连接。我不知道该怎么做,但我猜这与结果集有关。当我将结果设置更改为完整结果时,将循环断开。我假设您不能在循环中设置结果。

现在,我完全迷失了,因为我不知道如何保存这15个表的结果以及如何将它们声明为数据流任务中的来源。

I am a newbie to SSIS and currently struggling with executing SQL task saving the result in a result set and exporting each table to a respective CSV using a data flow task.

There are 15 .sql files stored in a folder which I am creating a variable called FolderPath pointing towards them. Then I create a for each container that reads from a folder and create a variable in the variable mapping which is called SQLfile.

Inside the for-each container I have an execute SQL task which I changed its file connection variable and edited the expression to FolderPath + SQLfile.

Executing this loop works, when the result set value is set to none. Now I am trying to connect the tables created from this loop in a data flow task. I have no idea how to do this but I am guessing it has something to do with the result set. When I change the result set to full result set my loop breaks. I am assuming you cant have a result set inside a loop.

Now I am completely lost as I don't know how to save the result of those 15 tables and how to declare them as source in the data flow task.

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

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

发布评论

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

评论(1

_蜘蛛 2025-02-15 00:45:38

将查询存储在变量中。然后在数据流任务中使用 ole db源组件,然后将“数据访问模式”设置为变量的 sql命令。

Store the query in a variable. Then use the OLE DB Source component in the Data Flow Task and set the 'data access mode' to sql command from variable.

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