Home Forums Programming XML Reading XML File into a table RE: Reading XML File into a table

  • What SQL Server version do you use?

    It might be easier to do it using XQuery, assuming you use SQL 2005 and up:

    SELECT

    v.value('medFormID[1]','int') AS ID,

    v.value('FormName[1]','varchar(50)') AS FormName

    FROM @xml.nodes('document') T(c)

    CROSS APPLY T.c.nodes('med_Form')U(v)



    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]