• Alex,

    Unfortunately, I must offer two criticisms of this article. At the end you said:

    Alex Grinberg (1/15/2014)


    My preference is the User-Defined Table type. I found that this technique is better optimized than the other methods discussed in this article.

    Normally, when you make a statement like that it is customary to provide some benchmarking information regarding specifically what you mean. Fortunately, in this case SQL MVP Erland Sommarskog has got your back in his definitive treatises on this concept:

    http://www.sommarskog.se/arrays-in-sql.html

    The second criticism is about the way that you've chosen to split your delimited list. Pretty well known around here is DelimitedSplit8K, championed by SQL MVP Jeff Moden in this article:

    Tally OH! An Improved SQL 8K “CSV Splitter” Function[/url]

    It is going to be orders of magnitude faster than the string splitter you've included.


    My mantra: No loops! No CURSORs! No RBAR! Hoo-uh![/I]

    My thought question: Have you ever been told that your query runs too fast?

    My advice:
    INDEXing a poor-performing query is like putting sugar on cat food. Yeah, it probably tastes better but are you sure you want to eat it?
    The path of least resistance can be a slippery slope. Take care that fixing your fixes of fixes doesn't snowball and end up costing you more than fixing the root cause would have in the first place.

    Need to UNPIVOT? Why not CROSS APPLY VALUES instead?[/url]
    Since random numbers are too important to be left to chance, let's generate some![/url]
    Learn to understand recursive CTEs by example.[/url]
    [url url=http://www.sqlservercentral.com/articles/St