开发者

Cannot put a SQL Task within a Foreach Loop

I am new to SSIS and I am relying on a book, so this should be an easy question to answer.

I want to import data from all of the text files within a directory. So I create a Foreach container.

The first thing I want to do within the loop is execute a SQL task to drop and create the landing table.

Then I want to load the data into the landing table from the selected text file using a Data Flow task.

Then I want to execute a SQL Task to load the SQL tables from the Landing table and do some calculations.

The problem is that within a Foreach loop, I cannot connect up a SQL Task to a Data Flow task. The message I get is

Cannot create connector. Cannot connect the executables from different containers.

开发者_如何学运维

So how do I do this?


How about a screen shot? I've used these 2 components in a loop container before with no problem, my guess is the GUI is a little deceptive here.


I know this is an old thread. I wanted to add to it though in case it is helpful to anybody.

In my case, I had the foreach loop container with some FTP Tasks and Script Tasks in it and I still need to add more within this foreach loop. I renamed the foreach loop and then added a new Script Task at the bottom of the flow of the foreach loop container. When I tried to connect the current FTP Task at the end of the flow of the foreach loop container to the new Script Task that I'd added at the bottom, I got the error about "Cannot create connector. Cannot connect the executables from different containers."

So I dragged the current FTP Tasks and Script Tasks outside of the newly renamed foreach loop container (or I suspect I could have cut them and pasted them outside the foreach loop container). I then dragged them all back into the newly renamed foreach loop container. I then connected them all again successfully without getting this error.

So it seems that once you rename a foreach loop container WITHOUT being done completely, when you add a new Task icon to the bottom of the flow of the newly renamed foreach loop container you might or will get the error about not being able to connect from different containers (since I guess the newly renamed foreach loop container is considered to be "different" than the old name of the very same foreach loop container.


I've had a similar problem, where is looked as though both the components were in the for loop. Whereas (similar to rageit's comment) one of the sub-compnents were actually on-top rather than within the foreach loop.

The quick fix was to cut the component, select the foreach loop and paste it in.


It looks like you are trying to connect a Sql Task within a foreach loop to a DataFlow task that is not in the loop. If that is what you are intending, you need to take the connection from the ForEach loop and connect it to the DataFlow. If, however, you want both the SQLTask and the Dataflow to run within the ForEachLoop, you need to put the DataFlow into the ForEach loop and then you will be able to connect the SQLTask to the DataFlow.


None was my case. I just moved it from different container to a new container. I had to recreate the task. There is no property to show you what container is holding the task. Definitely GUI bug. I'm using BI 2008


Solution that solved my problem is cut the component and paste it back. If there is a heirarchy of tasks cut all tasks one by one to delete their connections and paste them back and then connect from the top.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜