Sunday, April 6, 2014

Execute SQL Scripts using Foreach Loop Container

Execute SQL Scripts using Foreach Loop Container.
We can execute the SQL Scripts from file using the Foreach Loop Container in SSIS.
In this demo am using the two Control Flow Tasks.






For Each file enumerator is used to go through all file in a directory. suppose we have an SQL Scripts in a file need execute one by one for each loop is best option in SSIS.





Add a variable for dynamic file connection in for each loop





Make sure proper mapping variables.for first variable index should be zero.


Once its completed drag the execute SQL Task. 


Provide the connections for the execute SQL task


Make sure file connection type as file connection.











Once connection is ready execute the SSIS task.











No comments: