FOR EACH LOOP CONTAINER IN SSIS

We are Going to Learn about the ForEachLoop Container in SSIS in the Simplest way.

Step 1:- Drag and Drop a For each Loop Container as Shown in the Screenshot below


STEP 2:- Drag and Drop a data Flow task inside the For Each Loop Container







STEP 3:- Create a New Flat File Connection and Select any Flat file from the Folder.




STEP 4:- Create a New Sql Server Connection.




STEP 5:- Create a New Variable with data type String.




STEP 6:- Right Click on For Each Loop Container and click on edit and select Enumerator as ForEachLoop File Enumerator, Set the File path and File extension as highlighted in the Screenshot below. In this case, we will set the file extension as .CSV as we are using the CSV Files to fetch the data.




STEP 7:- Next Click on Variable Mapping and from the drop-down select the variable that you created in Step 5.




STEP 8:- Now the Final Step is to Right Click on the Flat file connection from the Connection manager and click PROPERTIES then click on Expressions from the property expression Editor and select Connection String.




STEP 9:- In The property, Expression dialog box click on Expression then in Expression Builder drag and drop the Variable in the expression and hit OK.




STEP 10:- Every file in the folder will be processed and will move to the table. in my case, each CSV file consists of 1000 Records




No comments: