How to run excute sql task within a Foreach Container in SSIS

Guys.
How do I assign sql excute task  inside the foreach  container ? I have following setting in "Foreach Loop Container" but when I import multiples files, the sql excute task which has truncate table command will truncate at each import and only last import available in the table.
ForEachLoop.PNG
motioneyeAsked:
Who is Participating?
 
motioneyeConnect With a Mentor Author Commented:
Hi,
Finally manage to fix this my self, simply I created a sql task ( to truncate the table ) outside the for each container, it works perfectly.
0
 
lcohanDatabase AnalystCommented:
I would add a "staging" table in between so that will be truncated in the loop and then another command after the staging table insert/population which will put the data from that staging table into a permanent one with exact same structure.
0
 
motioneyeAuthor Commented:
Fixing the issue myself by creating the sql task outside the for each container.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.