• Need to pass as many delimited strings as the number of parameters.

    Not true... please consider the following...

    http://www.sqlservercentral.com/articles/T-SQL/63003/

    Since, delimited string would be passed as a string data type, so limitation of size of string data supported in SQL Server 2005 comes into picture (4000 / 8000 characters max including the delimiter character).

    Definitely not true. Please check Books Online for VARCHAR(MAX) and NVARCHAR(MAX). It's not even true in SQL Server 2000 or SQL Server 7 if you don't mind working with the TEXT or NTEXT datatypes which can be passed as parameter in a stored procedure. There are also a fair number of fairly simple splitters for TEXT and NTEXT.

    I would also like to see a performance and resource usage comparison between passing delimited strings and XML strings. It might also be interesting to take a look at what very few people take pause to look at... the impact on the "pipe" and resources. For example...

    XML String:

    According to MS-Word, that bit of XML is 151 characters including spaces.

    Delimited String:

    Richard,1100|Cliff,1200|Donna1,3000|Ann,1500|

    According to MS-Word, that bit of delimited computational heaven is only 45 characters including the delimiters.

    Let's do a quick bit of math... (151-45)/45 = ~2.356. Translation: You have to pass more than 2-1/3 times more data over the "pipe" AND through the I/O resources of SQL Server (and the underlying Windows Server) for XML to do the same thing as the delimited string. THEN, you have to shred the XML or parse the delimited string. I haven't done the performance/resource usage comparisons between shredding and parsing, but rumor has it that shredding is a bit resource hungry compared to well formed parsing techniques (cteTally or just a Tally table... recurrsion is as bad as most loops).

    I've heard all the supposed advantages of passing XML like this... I'm just not finding they're all true especially the parts I listed at the beginning of this post.

    --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)