• Koen is right - Jeff Moden's DelimitedSplit8K function is the best approach I've seen for this. If you haven't read about it yet, its well worth the time. Be forewarned, it will change the way you look at strings and change your expectations of performance.

    Once you implement the function, here's how to accomplish exactly what you're trying to do:

    SELECT t.id, s.item

    FROM #temp t

    CROSS APPLY DelimitedSplit8K(data, ',') s

    ORDER BY t.id, s.item;