I want to make query xml value sql server and get auditingCompanyAddress value
create table sqm (data xml)
insert into sqm
select '<taxComplianceReport xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.gsis.gr/cpaaudit/v12">
<auditingGeneralInformation>
<auditingHeader>
<auditingCompany>
<auditingCompanyTitle>ΣΥΝΕΡΓΑΖΟΜΕΝΟΙ ΟΡΚΩΤΟΙ ΛΟΓΙΣΤΕΣ Α.Ε. </auditingCompanyTitle>
<auditingCompanyRegisterNum>125</auditingCompanyRegisterNum>
<auditingCompanyVatNumber>094394659</auditingCompanyVatNumber>
<auditingCompanyAddress>Φ. ΝΕΓΡΗ 3, 11257 ΑΘΗΝΑ</auditingCompanyAddress>
<auditingCompanyFee>4000</auditingCompanyFee>
</auditingCompany>
<certifiedAccountant1>
<certifiedAccountantsName>ΚΑΛΛΕΣ ΝΙΚΟΛΑΟΣ</certifiedAccountantsName>
<certifiedAccountantsRegisterNum>1590</certifiedAccountantsRegisterNum>
<accountantVatNumber>035209342</accountantVatNumber>
<certifiedAccountantsCity />
<certifiedAccountantsFee>0</certifiedAccountantsFee>
</certifiedAccountant1>
<disclaimer>true</disclaimer>
<companyName>ΣΑΛΑΓΙΑΝΝΗΣ Γ.ΑΒΕΕ</companyName>
<companyVatNumber>094357246</companyVatNumber>
<periodFrom>2018-01-01</periodFrom>
<periodTo>2018-12-31</periodTo>
<fiscalYear>2018</fiscalYear>
<conclusionReportVatCompliance>1</conclusionReportVatCompliance>
<nonImportantDiffReportVatCompliance>2</nonImportantDiffReportVatCompliance>
<pendingQuestions>false</pendingQuestions>
<fiscalSubjectsNotAuditedDueToVatProblems>
<exists>false</exists>
<comments />
</fiscalSubjectsNotAuditedDueToVatProblems>
</auditingHeader>
</auditingGeneralInformation>
</taxComplianceReport>'
I am try to get with the following sql query:
select
m.c.value('(auditingCompanyAddress)[1]', 'VARCHAR(max)') as auditingCompanyAddress
from sqm as s
outer apply s.data.nodes('taxComplianceReport/auditingGeneralInformation/auditingHeader/auditingCompany') as m(c)
but returns null. I think the problem is the taxComplianceReport but I dont know how to resolve.
Any idea?