>>Boris,
>>
>>Good point about table variables!
>>
>>I don't think you got it right, though it's a very interesting solution. I added an identity field to the TestOrders table to check it.
>>
>>We need record 2 to become 5.
>
>And how we should handle the GAP?
>Maybe 5 must becomes 2?
See what I started to think in this thread and another on this topic. We somehow need to decrement orders to fill the gap. It's a bit tricky logic and I hadn't time to figure this completely.
If it's not broken, fix it until it is.
My Blog