Example taken from Northwind
Create variables (in a collection of variables) that represent the columns in the table that will be created at runtime Example: -
Customer_ID as string Order_Id as int
Then you need to create an Execute SQL Task and write a query below to select the first 10 rows
Select top 10* from orders
Use FullResultSet and in the result set configuration save the table rows in the variable Name: - User :: Result ResultName: 0
Drop one SQL execution task and create a table on the fly
IF OBJECT_ID('myOrders') IS not NULL drop table myOrders Create table myOrders (OrderID int, CustomerID varchar(50) )
combine 2 threads from an Execute sql task and connect them to the Foreach loop
Drag the foreach loop. As an enumerator type, it is used as an ADO ADACHER enumerator. In the counter configuration, select the user :: Result variable, which stores the first 10 rows from the sql execution task and selects the "Rows in the first table" radio button. In the variable display, compare the column variables that u created on the first step, and the index will be 0 for the first column and 1 for the second column
Drag the sql execution task inside the foreach loop and write the following query:
Insert into myOrders( OrderID,CustomerID) values (?,?)
Match parameters using parameter mapping configuration in sql task execution
VariableName : OrderID Direction : Input DataType=Long ParamterName=0 VariableName : CustomerID Direction : Input DataType=varchar ParamterName=1