简体   繁体   中英

Execute SQL task (SSIS) and then insert the result set into a table on a different server

This is more of a generic question :

I have file1.sql, file2.sql , file3.sql in a folder. I can run a foreach container to loop through the files and execute it but I need the result set to go to respective tables sitting on a different server

file1 result set --> Server2.TableA file2 result set --> Server2.TableB .. etc

How can this be achieved through SSIS techniques ?

您可以使用foreach循环中的脚本任务来执行此操作,该脚本任务将分析结果集并将其插入到适当的目标表中。

You could also put all the records into a staging table on one server with additional columns for that server they will go to and a isprocesssed bit field.

At this point you could do any clean up required of the data.

Then create a separate dataflow for each server to grab the unprocessed records for that server. After they are sent, then mark the records as processed.

This will work if you only have a few servers. If there are many possibilities or you expect the number will continue to change, I would go with @TabAlleman's suggestion.

thestralFeather,

If you are new to SSIS, refer to msdn's tutorial on looping utilizing SSIS here . If you look at this page within the tutorial, you will see in the dataflow the output destination. @Tab Allerman and @HLGEM have provided good advice. When you look at the pages I've referred you to, just thing in terms of 2 separate loops dropping data to a single location that you can manage in a target dataflow.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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