0

I have a column in table with datatype XML. mycolumn has following value

 <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" 
    xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xmlns:xsd="http://www

.w3.org/2001/XMLSchema" 
xmlns:ns1="http://http://localhost/test/">
    <SOAP-ENV:Body>
        <ns1:IDResults>
            <NCNL>
                <Value>123</Value>
            </NCNL>
        </ns1:IDResults>
    </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

select mycolumn.query('./Envelope/Body')

My above select statement does not return anything.

Do I need to specify SOAP-ENV: prefix, if yes than how do I specify it?

Thanks in advance.

Roman Pekar
  • 107,110
  • 28
  • 195
  • 197

1 Answers1

0

The actual query depends on what you want to get, but basically you have to specify namespace in your query, like this:

;with xmlnamespaces ('http://schemas.xmlsoap.org/soap/envelope/' as [SOAP-ENV])
select @data.query('SOAP-ENV:Envelope/SOAP-ENV:Body/*')
Roman Pekar
  • 107,110
  • 28
  • 195
  • 197