简体   繁体   English

在SSIS中为Excel目标使用变量

[英]Using Variables in SSIS for an Excel Destination

I have a project where I need to extract data from a SQL Database into 40+ Excel Spreadsheets. 我有一个项目,需要从SQL数据库将数据提取到40多个Excel电子表格中。 What I am trying to do with SSIS is to use variables to set the name of the destination as I move through the workflow. 我要使用SSIS进行的操作是在工作流程中使用变量来设置目标的名称。 What tips and tricks do people have to do this? 人们要做哪些提示和技巧? If I set the variable value before I run the data flows it works but if I don't set them it fails. 如果我在运行数据流之前设置了变量值,则它可以工作,但如果不设置它们,则它将失败。 I have setup an Expression Task to set the variable in the flow but this doesn't seem to flow through to the SQL Task. 我已经设置了一个表达式任务来设置流中的变量,但这似乎没有流向SQL任务。 Are there any gotcha's with reading and writing to variables? 是否有读写变量的陷阱?

Cheers, Adam 干杯,亚当

If you need to achieve parallelism then the best way is to create the variables .Assign the excel sheet names and then execute all your data flow tasks at the same time . 如果需要实现parallelism那么最好的方法是创建变量。分配excel工作表名称,然后同时执行所有数据流任务。

If you are having a hard time to create 40 variables ,then you can go with foreach loop .Select the foreach loop item enumerato r .Specify all your file names .Inside the foreach loop drag and drop 40 DFT and based upon the value from foreach loop (using precedence constraint ) ,particular data flow task will be executed .But this way you will lose parallelism . 如果您很难创建40个变量,则可以使用foreach循环。选择foreach loop item enumerato r。指定所有文件名。在foreach循环内,拖放40 DFT并基于foreach的值循环(使用precedence constraint ),将执行特定的数据流任务。但是这样您将失去并行性。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM