• WayneS (10/10/2010)


    Using the DelimitedSplit8K function, you would end up with:

    DECLARE @String1 varchar(8000),

    @String2 varchar(8000);

    SET @String1 = 'a,b,c,d';

    SET @String2 = 'apple,boy,college,dog';

    SELECT a.Item, b.Item

    FROM dbo.DelimitedSplit8K(@string1, ',') a

    JOIN dbo.DelimitedSplit8K(@string2, ',') b

    ON a.ItemNumber = b.ItemNumber;

    Here is the latest version of the Delimited Split Function

    I guess I should add the latest performance enhancements to that and put it in the "Script Locker", huh?

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