• The before image should have read

    WHILE @COUNTER < (SELECT COUNT(*) FROM ##TEMP_TABLE)