Reading from variables to augment rows with data from variables isn’t readily apparent in SSIS. A workaround I found was to use a script task right before your OLE DB Destination and access the SSIS variable objects directly.
Script Task Setup
- Start with a standard Script Task in your data flow.
- Add columns to your output in the ‘Inputs and Outputs’ tab, set the names and output data types appropriately
- Access Variables in your ‘main’ script section by using the following code
IDTSVariables100 vars = null; //Gets reference to the SSIS Variables this.VariableDispenser.LockOneForRead("session", ref vars);//Locks the Variable in quotes, for Read ….use LockOneforWrite to write to variable string temp = (string)vars.Value;//Assigns to value to a string Row.sessionId = Convert.ToInt32(temp);//converts to Int vars.Unlock();//Unlocks the var.