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

ErickTreetops
  • 3,189
  • 4
  • 27
  • 37

3 Answers3

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

Joost
  • 1,873
  • 2
  • 17
  • 18
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.

ErickTreetops
  • 3,189
  • 4
  • 27
  • 37
0

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

  • 2
    You may need to give some details! – Badro Niaimi Dec 03 '19 at 19:23
  • 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. https://meta.stackexchange.com/questions/214173/why-do-i-need-50-reputation-to-comment-what-can-i-do-instead – Yunnosch Dec 03 '19 at 19:38