May 14, 2016 at 7:06 am
:crying:
Its been over 12 hours, and i am tapping in...
SSIS For Each Loop is not accepting variable from SQL Query Task.
The SQL Query select table names, which should be looped through and each passed to a Data flow task to select * from TableName and write data to a TableName.txt file
Errors:
1. User::obj" does not contain a valid data object
When Using String Variable as Result Name for Tables query
2. Illegal characters in path
Using String Variable
What I have tried:(See Pic attached)
I have the SSIS package with
1. SQL Query Task (Get TableNames to ObjectVariable)
2. For Each Loop (ADO Enumerator ObjectVariable , mapped to string Variable TableName)
3. Data Flow task(Ole DB Source & FlatFile Destination)
3.a.Ole DB Source = Select * from TableName
3.b. Write data to TableName.txt
May 19, 2016 at 2:19 pm
I don't think you can use a SQL Query task to get the table names.
I believe you will need to add a Data Flow, and in the data flow use an OLE DB source to query the table names from your database. You can then use a Recordset destination, which will allow you to specify an object variable to put the recordset into.
Once you've done that, you should then be able to set the ForEach loop up to loop through the records in the recordset stored in your object variable.
May 24, 2016 at 9:40 pm
Thanks. I'll try that and update you.
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply