• dg81328 (5/31/2013)


    even though u successfully loaded the raw xml into a table you still processed the data one row at a time. It is much better to use OPENXML and pivot the data.

    I'm not sure how you can say that so please explain. From what I can see, the methods in the article will allow you to handle multiple XML documents that are loaded into a table (@CD in the article is a table variable) without RBAR whereas the OPENXML document that you suggest can only handle one XML document at a time.

    Further, and I admit that I haven't tested it, I suspect that code you posted will be slower because of the PIVOT.

    Like I said, please explain your claims about why you think the use of OPENXML and a pivot provides any advantage of the method in the article because I'm just not seeing it and am always interested in better ways.

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