Parsing OpenXML with multiple elements of the same name
问题 I have a data structure as such: <rootnode> <group> <id>1</id> <anothernode>first string</anothernode> <anothernode>second string</anothernode> </group> <group> <id>2</id> <anothernode>third string</anothernode> <anothernode>fourth string</anothernode> </group> </rootnode> And the following code: EXEC sp_xml_preparedocument @index OUTPUT, @XMLdoc SELECT * FROM OPENXML (@index, 'rootnode/group') WITH ( id int 'id', anothernode varchar(30) 'anothernode' ) which gives me the result id |