• born2achieve (3/15/2014)


    Hi,

    i read the below link article and and use the below function for splitting the string. I love the Jeff moden's split string and below code has modified by Aaron on top of the jeff's function.

    That's a bad modification, IMHO, and I wouldn't be tempted to use it for anything important.

    First, the input has been changed to a MAX datatype but the largest number that can come of the cascading CTE will only support a million characters. Since it's an NVARCHARMAX, it needs to support a billion characters and a count of 2 billion.

    Second, the delimiter has been changed from 1 character to 255. If you don't have multicharacter delimiters all that's going to do is slow things down.

    Third, the code hasn't been modified to work with a multicharacter delimiter and it will lead to some pretty bad returns if you ever use one.

    Fourth, if the final element is longer than 8000 characters, it will be truncated because the code wasn't setup to handle NVARCHAR(MAX) correctly.

    Last, the code isn't close to the latest, higher performance version.

    As a bit of a sidebar, the reason why I didn't write this to handle the MAX datatypes is because blobs don't like to be joined to. Using a MAX datatype here will cause it to perform at least 2 times slower even if you pass it something less than 8000 characters.

    My recommendation is that if you need to split things that live in a MAX datatype, then either use BCP/BULK INSERT to load it or use a well written CLR to split it.

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