• As part of personal experience, I would suggest to get away from cursors for this thing. Making complex calculations one row at a time will slow down your system in an awful way.

    We can help you getting a better way to handle everything in sets.

    For now, try to print @AutexCount value to see if you're actually having anything to update. It might always have a 1 as a value.

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2