将SQL查询的文件夹导出到SSIS中的CSV中
我是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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
将查询存储在变量中。然后在数据流任务中使用 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.