Here is one approach.
Create an object type variable.
Create an Execute SQL Task that captures your source data and loads it into a variable (ADO.NET).
Create a container for the ForEach pipeline.
Drag the Success connector (green) from Run SQL Task to ForEach Outline Container. Change the Enumerator in the loop container to "foreach ADO Enumerator" and select your variable from the "ADO object source variable".
In your loop, you should add a βRun SQL Taskβ that you can work with.
You should be able to use SCOPE_IDENTITY () to get each identifier after inserting it into the main table and use it to insert it into the details table.
source share