SSIS: How can I manipulate data from one table in a dataflow and then put it into another table?
For instance, I have DB A and DB Bb, I would like to set up a data flow task where I take the first ten rows from Table A and programmatically put them in XML format in a string builder. Then, once I have it in the stringbuilder, put the entire string into a row in a table in Database B.
My question is simply How do i get started?? In 2000 I could do this in a DTS Package through an ActiveX script in the data transformation task. I have to figure this out this week so any help is so greatly appreciated.
I am on SQL Server 2008 using BIDS 2008开发者_如何学Python.
You'll be able to do this in an SSIS Data Flow. In the Data Flow, you'll add a Source and configure it to select the data from the DB A. Add a Script Component as a transformation. Edit the Script Component and select the Inputs and Outputs tab. Select Output 0 and then change the Synchronous Input ID value to None.
By default a Script Component is synchronous. For each row that enters the component one row exits the component. By setting the Synchronous Input ID value to None, you are setting the component to asynchronous mode, which doesn't ensure that for each row in, there will be one row out.
Expand the Output 0 branch and select the Output Columns item. From here add the columns that will be outputs from the component.
Now you can add your code to the script. You can look into Row.NextRow() to move to the next input row, and Output0Buffer.AddRow() to add output rows.
精彩评论