Increment a variable within a Foreach Loop and use it-SSIS

后端 未结 1 1317
孤独总比滥情好
孤独总比滥情好 2021-01-20 04:09

I have a package i am using the foreach loop to loop through the databases. I am passing a string and it loops though all the databases. Everything is perfect till here.

相关标签:
1条回答
  • 2021-01-20 04:46

    The variable varblthat you created only exists in the script context.

    To increment the SSIS variable you need to do something like

    public void Main()
    {
        int varbl = Convert.ToInt32(Dts.Variables["User::myvariable"].Value.ToString());
        varbl++;
        Dts.Variables["User::myvariable"].Value = varbl;
    }
    

    or the variable User::myvariable will not be changed

    0 讨论(0)
提交回复
热议问题