I expected this to be straight forward but I am missing something obvious. I want to read an Excel file and for each row in the Excel file perform an update on an SQL Server table.
I have a package with a single 'Data Flow Task' that on success performs a 'ForEach Loop'.
The 'Data Flow Task' seems to work fine.
I have set the 'Recordset Destination' to store the rows in a VariableName defined on the 'Component Properties' tab. The Variable is defined in my variables list as an Object with Package scope. I have limited the columns selected from the Excel sheet to two from a list of many columns.
This bit seems to work. In debug I can see the number of rows above the pleasently green 'Recordset Destination' task.
What does not work is the interaction between the 'ForEach Loop' and the 'Execute SQL Task' inside it.
ForEach Loop
I have set the Enumerator to 'Foreach ADO Enumerator'.
I have set the ADO Object Source Variable : User:MyRecordSet
Execute SQL Task
I have set the SQL server connection up ( I know this is working ).
I have set up a Direct input command of :-
I have set the Parameter Mapping to User::MyRecordSet
[/code]
The problems I have start with a failure of the SQL Statement to parse. It does not accept the '?' as a parameter and I don't know why. How should I be refering to the recordset fields within this type of SQL Statement?
Dazed and confused
I have a package with a single 'Data Flow Task' that on success performs a 'ForEach Loop'.
The 'Data Flow Task' seems to work fine.
I have set the 'Recordset Destination' to store the rows in a VariableName defined on the 'Component Properties' tab. The Variable is defined in my variables list as an Object with Package scope. I have limited the columns selected from the Excel sheet to two from a list of many columns.
This bit seems to work. In debug I can see the number of rows above the pleasently green 'Recordset Destination' task.
What does not work is the interaction between the 'ForEach Loop' and the 'Execute SQL Task' inside it.
ForEach Loop
I have set the Enumerator to 'Foreach ADO Enumerator'.
I have set the ADO Object Source Variable : User:MyRecordSet
Execute SQL Task
I have set the SQL server connection up ( I know this is working ).
I have set up a Direct input command of :-
Code:
INSERT INTO MySQlTable (MyColumn) VALUES(?)
[/code]
The problems I have start with a failure of the SQL Statement to parse. It does not accept the '?' as a parameter and I don't know why. How should I be refering to the recordset fields within this type of SQL Statement?
Dazed and confused