0
votes

I have a Source Script Component in SQL2012. I believe if you want to set a Read/write variable in the Scriptcomponent it must be set in the Postexecute method . And I have done so like this;

    public override void PostExecute()
{
    base.PostExecute();
    Variables.value1 = "some value";
}

I tested the variable after the script component ran and found it hadn't been set. I set a break point in the PostExecute method and confirmed it never gets called.

I even wrote a very simple new package and tested it again with the same results. Can anyone tell me why the PostExecute will not fire.

I'm not aware of any restrictions on seting a variable here (regardless of if there are records to process or not).

3

3 Answers

0
votes

The variable can be set in the script component, but you can only use it after the Data Flow task is finished (in the next task).

0
votes

After some testig it appears that when you use a script component as a "Source" the PostExecture event never fires. Works fine a "Transformation". Didn't test out "Destination" type. Nothing in the Microsoft documentation mentions this fact so it's missleading.

I ended up using the rowcount control to count records. Not sure what I would have done if i had needed to to more on the PostExecture event.

0
votes

I have used a Script Component as a source many times and PostExecute does fire.