我无法从保存在SQL Server数据库中的XML文本中获取一些数据。我的数据如下:从SQL中选择数据来自SQL
<retConsReciCTe xmlns="http://www.portalfiscal.inf.br/cte" versao="3.00">
<tpAmb>2</tpAmb>
<verAplic>SP-CTe-25-05-2017</verAplic>
<nRec>351000011484798</nRec>
<cStat>104</cStat>
<xMotivo>Lote processado</xMotivo>
<cUF>35</cUF>
<protCTe versao="3.00">
<infProt>
<tpAmb>2</tpAmb>
<verAplic>SP-CTe-25-05-2017</verAplic>
<chCTe>35170623838348000310570000000058731000058731</chCTe>
<dhRecbto>2017-06-22T21:28:18-03:00</dhRecbto>
<cStat>232</cStat>
<xMotivo>Rejeição: IE do destinatário não informada</xMotivo>
</infProt>
</protCTe>
</retConsReciCTe>
我要选择仅在内容。出于这个原因,我运行下面的查询:
select top 10 retorno_sefaz_doc.value('(/retConsReciCTe/@xmln)[1]','varchar(10)') as [retorno] from documentos
而我的回报始终是NULL。有人可以轻轻地帮我告诉我出了什么问题?
什么是您预期的输出? – TriV
我想将内容转换为版本。在这种情况下,3.00 –