sql server - SQL query to retrive value from XMl xolumn -
i have column in table 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 not return anything.
do need specify soap-env:
prefix, if yes how specify it?
thanks in advance.
the actual query depends on want get, have specify namespace in query, this:
;with xmlnamespaces ('http://schemas.xmlsoap.org/soap/envelope/' [soap-env]) select @data.query('soap-env:envelope/soap-env:body/*')
Comments
Post a Comment