Here's something to get you started:;with xmlnamespaces('urn:h12-org:v3' as ns)select x.value('ns:patientRole[1]/ns:id[1]/@extension[1]', 'nvarchar(50)') as extension , x.value('ns:patientRole[1]/ns:patient[1]/ns:name[1]/ns:given[1]', 'nvarchar(50)') as GivenName , x.value('ns:patientRole[1]/ns:patient[1]/ns:name[1]/ns:family[1]', 'nvarchar(50)') as FamilyName , x.value('ns:patientRole[1]/ns:addr[1]/ns:streetAddressLine[1]', 'nvarchar(50)') as [Address] , x.value('ns:patientRole[1]/ns:telecom[1]/@value', 'nvarchar(50)') as telephonefrom @xml.nodes('/ns:ClinicalDocument/ns:recordTarget') n(x)
The rest of the values can be extracted in a similar fashion