Hi,
My procedure to implement a task is like this
I will be using execute SQL task to fetch the records from source,after this wanna use For each loop to access each record one at a time,perform some trnsformations and insert that record into destination.
Help me in accessing the data stored in the Variable(SQL task) in Dataflow task of foreach loop.
Why do you need to do this one record at a time - is the transformation different for each record ?
Can you explain the transformations you need to do?
|||
In the Exec SQL task Editor:
1. General Tab - Result should be of type Full Resultset.
2. ResultSet tab - Set Result Name =0 , Variable Name= your variable of type object (you can create a new variable from the Variable Name dropdown itself, or in the main Variables Pane). Variable type =Object.
http://technet.microsoft.com/en-us/library/ms141689.aspx has details.
3. Add a For Each Loop Container.4. In the forEach Loop editor, Collection Tab, Set Enumerator=For Each ADO Enumerator
5. In the Variable Mapping, map your column variables to index 0,1,2 (assuming you have three columns in your resultset). You can create your own variables for each column. For each iteration i.e. for each row of the resultset, these variables will hold the value of the respective columns for the current row.
6. Perform your transformations
7. Use a OLEDB Command destination to insert/update your row to the table.
HTH
Kar
|||The requriment from is in that way,I have proposed for a bulk process.But m not sure if i will get the approval.|||
The index value to be set are in tenh order of retreival from source.
How to access those variables inTansformations can u be specific using Derived column.
|||
You'll get much better performance if you use an OLE DB Source inside a data flow, rather than iterating through a resultset with a For Each. You might want to revisit your design, or post more specifics so we can help you a little more.
|||Hi,
I will be having a SQL query to retreive data from source,incorporated in Execute SQL task.
Result will be stored in a Result Set.
After this inside a ForEach loop i have to access single record contained in the result set apply some transformations and send the data into destination.
So my requirement is to process one row of data at a time and whole data processing must take place in a loop.
My problem is,How do i process this data in Data Flow task inside For Each loop.
|||Hi,
You can achive this by this method(i have tried it out)
Use source query and populate the Recordset destination(variable must be of type object)
For each loop(enumerte through adonet)
Based on number of columns declare those many variables and access them in a script componet(source)
and output those variables as columns,
Do the transformations and insert into destination finally.
Any queries post it here.I will help u out.
|||Sorry, but I'm still not understanding why you have to loop through the recordset rather than using an OLEDB Source. However, if it works for you, stick with it.
No comments:
Post a Comment