Hi @SQL ServerQuery
Try this query:
SELECT
ROW_NUMBER()OVER(ORDER BY Caseid.value('@caseid[1]', 'int')) AS RowID,
Caseid.value('@caseid[1]', 'int') AS caseid,
offeree.value('@name[1]', 'NVARCHAR (200)') AS Offeree_Name,
offeree.value('@offer_period_commenced[1]', 'VARCHAR(20)') AS Offer_Period_Commenced,
twoten_information.value('name[1]', 'VARCHAR(20)') AS Name,
twoten_information.value('ISIN[1]', 'VARCHAR(20)') AS ISIN,
twoten_information.value('NSI[1]', 'VARCHAR(20)') AS NSI,
offeror.value('@name[1]', 'NVARCHAR (200)') AS Offeror_Name,
offeror.value('@rule_26_deadline[1]', 'NVARCHAR (200)') AS Offeror_rule_26_deadline,
offeror.value('@offeror_identified[1]', 'NVARCHAR (200)') AS Offeror_identified,
offeror.value('empty_2.10[1]', 'NVARCHAR (200)') AS [Offeror_empty_2.10]
FROM @myDoc.nodes('/disclosure_table/maintable/case') AS XMLtable1(Caseid)
CROSS APPLY Caseid.nodes('offeree') XMLtable2(offeree)
CROSS APPLY Caseid.nodes('offeror') XMLtable3(offeror)
CROSS APPLY offeree.nodes('twoten_information/twoten_line') XMLtable4(twoten_information)
Output:
Best regards,
LiHong
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our Documentation to enable e-mail notifications if you want to receive the related email notification for this thread.