• The set-up seems to be OK.

    You can use breakpoints to stop the loop at every iteration, so you can inspect the variables.

    On a sidenote: this set-up takes only a few simple lines in .NET 😀

    Need an answer? No, you need a question
    My blog at https://sqlkover.com.
    MCSE Business Intelligence - Microsoft Data Platform MVP