Read XML data into hierarchical tables
问题 I have XML data that is used to store quiz results. I need to convert this into two tables, one containing the questions, and the other containing the answers, but crucially, have a relation between them. Currently this relation only exists in the XML structure (there are no ID values, etc.). After a day of research and testing out different approaches, I've got as far as extracting the two parts, but cannot figure out how to create the hierarchy: declare @xml xml = N'<quizresult> <question>