Hi,I've got an XML structure which looks a bit like this:<location> <document id="1" sortOrder="1"> <title></title> <author></author> <abstract></abstract> </document> <document>..</document> <document>..</document></location>
I need to read each document as a row into a temp table from which I can then run other queries. However, I'm a bit stuck on the syntax of how to get both the attributes and the tag data from each document object.This is how I'd grab the tags and put them into a temp table:select title, author, abstractinto #tempData from openxml (@idoc, '/location/document/', 2) with ( title varchar(4000), author varchar(4000), abstract varchar(4000) )
And I know that to get attributes you replace the "2" with a "1" in the openxml call. But how can I do both together?Cheers,Matt