0

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 Answers 3

0

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).

Sign up to request clarification or add additional context in comments.

1 Comment

How does that prevent the event from firing ?
0

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.

Comments

0

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

2 Comments

You may need to give some details!
This seems to be a "cannot reproduce" comment. It surely does not solve OPs problem. For this kind of (in itself not inappropriate) comment, please use a comment, not an answer. meta.stackexchange.com/questions/214173/…

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.