• I guess, if the rewriting your stored proc to work on a required set is not an option, use advise about converting proc into TVF and use it with CROSS APPLY - that will give you the best possible solution.

    However, if it's also not an option, choosing between CURSOR and WHILE LOOP is pointless. Do not bother! You will find no much difference between properly implemented CURSOR and WHILE LOOP. Both of them are two sides of the same RBAR coin 😉

    _____________________________________________
    "The only true wisdom is in knowing you know nothing"
    "O skol'ko nam otkrytiy chudnyh prevnosit microsofta duh!":-D
    (So many miracle inventions provided by MS to us...)

    How to post your question to get the best and quick help[/url]