Home Forums SQL Server 2008 T-SQL (SS2K8) How do you map to rows inside different branches of same XML document using OPENXML rowset function? RE: How do you map to rows inside different branches of same XML document using OPENXML rowset function?

  • @alan:

    as long as it is guaranteed there'll always be a single node for each and every node block referenced in the code, I agree that your code is more efficient.

    But how about having an unknown number of media represented by multiple nodes of media_drive_and_media_info?

    In such a scenario your code would just return the first node ignoring all following nodes, finally leading to a "wrong" result set.

    To me it seems like a classic example of "it depends" 😉

    If it can be guaranteed that each node will be unique, I'd recommend your solution. Otherwise I wouldn't. It depends. 😎



    Lutz
    A pessimist is an optimist with experience.

    How to get fast answers to your question[/url]
    How to post performance related questions[/url]
    Links for Tally Table [/url] , Cross Tabs [/url] and Dynamic Cross Tabs [/url], Delimited Split Function[/url]