>>I think to make things easier and not to run select inside the loop I would just hardcode 5 cases depending on mod(counter) - need to find the equavalent T-SQL function.
>
> int1 % int2
>
I actually mistyped and had 10mln for my counter. <g> The system was very low on resources when I checked. It is still attempting to cancel the query <g>
If it's not broken, fix it until it is.
My Blog