首页 > 解决方案 > 在 SQL Server 结果中查询 XML 的问题

问题描述

我需要一些帮助 - 我有这个 XML

DECLARE @xml XML;
SELECT  @xml = (SELECT TOP(1) codigo, Numero, fecha, transportista, chofer 
                FROM @tbl
                FOR XML PATH(''), TYPE, ROOT ('root'));

SELECT 
    @xml.query('<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">    <soapenv:Body>        <CrearViaje4 xmlns:unis="http://unisolutions.com.ar/">{for $x in /rootreturn $x/*}</CrearViaje4></soapenv:Body></soapenv:Envelope>');

在行中<CrearViaje4 xmlns:unis="http://unisolutions.com.ar/">

我只需要<CrearViaje4 xmlns="http://unisolutions.com.ar/">

但如果我删除:unis

当我执行我的句子时,它不显示信息

标签: sql-serverxmlsqlxml

解决方案


推荐阅读