Parsing nested XML into SQL table

前端 未结 3 1966
南笙
南笙 2020-12-29 17:22

What would be the right way to parse the following XML block into SQL Server table according to desired layout (below)? Is it possible to do it with a single SELECT statemen

3条回答
  •  温柔的废话
    2020-12-29 18:22

    Use the OPENXML function. It is a rowset provider (it returns the set of rows parsed from the XML) and thus can be utilized in SELECT or INSERT like:

    INSERT INTO table SELECT * FROM OPENXML(source, rowpattern, flags)
    

    Please see the first example in the documentation link for clarity.

提交回复
热议问题