0

I use VS 2008 SSIS.

  1. I have a Data Flow Task to get rows from table and store them in an Object variable.
  2. I use Foreach Loop to get the Object variable's value one by one.
  3. Inside my Foreach I use Script Task to change/decrypt my variable's value each time.

My problem is I cannot find how to store the decrypted values back to Object variable because I need them save to Flat File.

I used another Object variable and tried to save the decrypted values in it. But saves only last decrypted value not whole list.

Please share your thoughts or advice. Any help or suggestions would be greatly appreciated!

2 Answers 2

1

You can access the object variable without an SSIS Foreach Loop. The example below populates a DataTable from the object variable, updates the DataRow for the column named in the C# foreach loop, and writes this back out to the object variable. After this Script Task you can do whatever is necessary with the updated contents of the object variable, including writing to a Flat File Destination.

            DataTable dt = new DataTable();
            OleDbDataAdapter adapter = new OleDbDataAdapter();
            adapter.Fill(dt, Dts.Variables["User::YourObjectVariable"].Value);

            foreach (DataRow r in dt.Rows)
            {
                r["Column"] = " "; //Do work here

            }

            Dts.Variables["User::YourObjectVariable"].Value = dt;
Sign up to request clarification or add additional context in comments.

1 Comment

Thank you for your suggestion. I used DataTable in Script Component. Then it worked! Thanks again!
0

Since your goal is to save the decrypted values to a flat file, you could create a final dataflow and use your object variable as a Source, do your decrypting in a Script Transformation (instead of a task), and send the results to your flat file destination.

1 Comment

Thank you for your clue about Script Transformation! I used Script Component with DataTable from above comment. Now it works :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.