• The problem here is understanding what you have to do with a cursor.   In order to get the loop to work correctly, you have to be able to do your FETCH NEXT at the BEGINNING of the loop, as what happens in your code is that the last FETCH happens, but your code doesn't do anything with it because the last FETCH changes the value of @@FETCH_STATUS, and then the loop checks the value of that at the beginning of the loop, and immediately stops.   That's why you always have to process the first record BEFORE you enter your loop.

    Steve (aka sgmunson) 🙂 🙂 🙂
    Rent Servers for Income (picks and shovels strategy)