• Thanks for taking the time for that feedback, Hugo. I appreciate it.

    Running totals are no excuse for using cursors... not even for display.

    http://www.sqlservercentral.com/articles/Advanced+Querying/61716/

    So far as the "bin packing" thing goes, I too am remiss... I said I think I know a set based way to do it and I just haven't gotten back to it. My appologies to you and myself because it's definitely an interesting problem and sounds like a lot of fun.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    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.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)