<legend id='TXOlC'><style id='TXOlC'><dir id='TXOlC'><q id='TXOlC'></q></dir></style></legend>

  • <i id='TXOlC'><tr id='TXOlC'><dt id='TXOlC'><q id='TXOlC'><span id='TXOlC'><b id='TXOlC'><form id='TXOlC'><ins id='TXOlC'></ins><ul id='TXOlC'></ul><sub id='TXOlC'></sub></form><legend id='TXOlC'></legend><bdo id='TXOlC'><pre id='TXOlC'><center id='TXOlC'></center></pre></bdo></b><th id='TXOlC'></th></span></q></dt></tr></i><div id='TXOlC'><tfoot id='TXOlC'></tfoot><dl id='TXOlC'><fieldset id='TXOlC'></fieldset></dl></div>
    <tfoot id='TXOlC'></tfoot>
  • <small id='TXOlC'></small><noframes id='TXOlC'>

      • <bdo id='TXOlC'></bdo><ul id='TXOlC'></ul>

      1. 在 FOR XML AUTO 模式下为 XML 标签添加前缀

        时间:2023-06-07

            <tbody id='KI5K8'></tbody>

            <small id='KI5K8'></small><noframes id='KI5K8'>

            • <bdo id='KI5K8'></bdo><ul id='KI5K8'></ul>
            • <legend id='KI5K8'><style id='KI5K8'><dir id='KI5K8'><q id='KI5K8'></q></dir></style></legend>
              <tfoot id='KI5K8'></tfoot>
              • <i id='KI5K8'><tr id='KI5K8'><dt id='KI5K8'><q id='KI5K8'><span id='KI5K8'><b id='KI5K8'><form id='KI5K8'><ins id='KI5K8'></ins><ul id='KI5K8'></ul><sub id='KI5K8'></sub></form><legend id='KI5K8'></legend><bdo id='KI5K8'><pre id='KI5K8'><center id='KI5K8'></center></pre></bdo></b><th id='KI5K8'></th></span></q></dt></tr></i><div id='KI5K8'><tfoot id='KI5K8'></tfoot><dl id='KI5K8'><fieldset id='KI5K8'></fieldset></dl></div>

                  本文介绍了在 FOR XML AUTO 模式下为 XML 标签添加前缀的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  限时送ChatGPT账号..

                  我想知道是否可以在每个 ELEMENT TAG 之前添加 TAG PREFIXFOR XML AUTO 模式的结果.

                  我知道使用 RAW 模式是可能的,但我需要使其尽可能分层 xml 结果

                  像这样:

                   

                  <prefix:ID>值</prefix:ID><前缀:名称>值</前缀:名称></prefix:attName>

                  并且RAW模式下的查询将是这样的:

                  SELECT ID,姓名,从表名FOR XML RAW ('prefix'), ROOT('prefix:attName'), ELEMENTS

                  解决方案

                  您可以使用别名来实现:

                  WITH XMLNAMESPACES ('prefix' AS 前缀)SELECT ID AS [前缀:ID],名称 AS [前缀:名称]FROM TableName AS [前缀:attName]FOR XML AUTO, ROOT('prefix:attName'), ELEMENTS

                  I'd like to know if it is possible to add TAG PREFIX before every ELEMENT TAG in the result of FOR XML AUTO mode.

                  I know it's possible with RAW mode but I need to make its as hierarchy as possible xml result

                  Something like this:

                         <prefix:attName>
                          <prefix:ID>value</prefix:ID>
                          <prefix:name>value</prefix:name>
                        </prefix:attName>
                  

                  and the query in the RAW mode will be like this:

                  SELECT ID, 
                        Name,
                  FROM TableName 
                  FOR XML RAW ('prefix'), ROOT('prefix:attName'), ELEMENTS
                  

                  解决方案

                  You can achieve this using Aliases:

                  WITH XMLNAMESPACES ('prefix' AS prefix)
                  SELECT  ID AS [prefix:ID], 
                          Name AS [prefix:Name]
                  FROM    TableName AS [prefix:attName]
                  FOR XML AUTO, ROOT('prefix:attName'), ELEMENTS
                  

                  这篇关于在 FOR XML AUTO 模式下为 XML 标签添加前缀的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:如何使用 XQuery 模拟 STRING_AGG()(分组字符串连接 下一篇:SQL Server XML 字符串操作

                  相关文章

                  最新文章

                  <tfoot id='7Shbr'></tfoot>
                    <bdo id='7Shbr'></bdo><ul id='7Shbr'></ul>

                • <small id='7Shbr'></small><noframes id='7Shbr'>

                      <i id='7Shbr'><tr id='7Shbr'><dt id='7Shbr'><q id='7Shbr'><span id='7Shbr'><b id='7Shbr'><form id='7Shbr'><ins id='7Shbr'></ins><ul id='7Shbr'></ul><sub id='7Shbr'></sub></form><legend id='7Shbr'></legend><bdo id='7Shbr'><pre id='7Shbr'><center id='7Shbr'></center></pre></bdo></b><th id='7Shbr'></th></span></q></dt></tr></i><div id='7Shbr'><tfoot id='7Shbr'></tfoot><dl id='7Shbr'><fieldset id='7Shbr'></fieldset></dl></div>
                    1. <legend id='7Shbr'><style id='7Shbr'><dir id='7Shbr'><q id='7Shbr'></q></dir></style></legend>