There is nothing in your table to guarantee the processing order within an ID. Without such a thing, this is doomed to failure.
If the goal is to process in order by both the ascending order of both the ID and the Value, then such a thing can be done quite easily but if you're trying for something like load balancing, then that won't work.
What is this for? Load Balancing? Packing Boxes/Bins? Assigning tasks by duration? What?
is pronounced ree-bar and is a Modenism for R
First step towards the paradigm shift of writing Set Based code: Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column.
If you think its expensive to hire a professional to do the job, wait until you hire an amateur. -- Red Adair
When you put the right degree of spin on it, the number 318
is also a glyph that describes the nature of a DBAs job. Helpful Links:
How to post code problemsHow to post performance problemsForum FAQs