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

    1. <legend id='HUx9I'><style id='HUx9I'><dir id='HUx9I'><q id='HUx9I'></q></dir></style></legend>

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

        如何在 SQL 中拆分具有相同子子名称的两个 xml 标

        时间:2023-06-07
        <tfoot id='u1WuH'></tfoot>
      2. <i id='u1WuH'><tr id='u1WuH'><dt id='u1WuH'><q id='u1WuH'><span id='u1WuH'><b id='u1WuH'><form id='u1WuH'><ins id='u1WuH'></ins><ul id='u1WuH'></ul><sub id='u1WuH'></sub></form><legend id='u1WuH'></legend><bdo id='u1WuH'><pre id='u1WuH'><center id='u1WuH'></center></pre></bdo></b><th id='u1WuH'></th></span></q></dt></tr></i><div id='u1WuH'><tfoot id='u1WuH'></tfoot><dl id='u1WuH'><fieldset id='u1WuH'></fieldset></dl></div>

          <tbody id='u1WuH'></tbody>
        <legend id='u1WuH'><style id='u1WuH'><dir id='u1WuH'><q id='u1WuH'></q></dir></style></legend>

            <bdo id='u1WuH'></bdo><ul id='u1WuH'></ul>

                • <small id='u1WuH'></small><noframes id='u1WuH'>

                • 本文介绍了如何在 SQL 中拆分具有相同子子名称的两个 xml 标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  限时送ChatGPT账号..

                  我创建了一个脚本,它从 SQL 中的表中获取数据并生成 XML 输出.父、子和子子标签对于 2 个标签都是相同的.SQL 脚本将它们作为一个 XML 值而不是 2 输出.

                  I have created a script which takes data from a table in SQL and generates an XML output. The parent, child and sub-child tags are all the same which for 2 tags. The SQL script is outputting them as one XML value instead of 2.

                   SELECT
                   Request.TransactionRef AS [RequestHeader/RequestID],
                  'Deal.Trial' AS [RequestHeader/Action],
                  'DoDealValidate' AS [RequestHeader/ActionFlags/Flag],
                  'DoDealDerive' AS [RequestHeader/ActionFlags/Flag] 
                  

                  目前的结果是:

                  <ActionFlags>
                  <Flag>DoDealValidateDoDealDerive</Flag>
                  </ActionFlags>
                  
                  
                  
                  
                  <ActionFlags>
                  <Flag>DoDealValidate</Flag>
                  <Flag>DoDealDerive</Flag>
                  </ActionFlags>
                  

                  推荐答案

                  只需在中间放置一些:

                  SELECT
                   'blah' AS [RequestHeader/RequestID],
                  'Deal.Trial' AS [RequestHeader/Action],
                  'DoDealValidate' AS [RequestHeader/ActionFlags/Flag],
                  NULL AS [RequestHeader/ActionFlags],
                  'DoDealDerive' AS [RequestHeader/ActionFlags/Flag] 
                  FOR XML PATH('row');
                  

                  背景:

                  引擎通过 SELECT 的列运行并一个接一个地构建它们.

                  The engine is running through the SELECT's columns and builds them one after the other.

                  • 好吧,有一个要打开
                  • 并且有一个要打开
                  • 再次,还是打开的,没什么
                  • 下面还有...哦,我们必须关闭并打开一个新的
                  • 等等...
                  • Well, there is a <RequestHeader> to open
                  • and there is a <RequestID> to open
                  • Again the <RequestHeader>, still open, nothin to to
                  • and there is <Action> below... Oh, we must close the <RequestID> and open a new <Action>
                  • and so on...

                  在您的代码中, 仍然是打开的,因此内容被写入到 open 元素中.

                  In your code the <Flag> is still open, therefore the content is written into the open element.

                  我的改变会让引擎思考

                  • 啊,我们上移一层,所以我们先关闭...哎呀,没什么可写的...
                  • 现在<Flag>有一些东西,它不再打开了,我们必须重新打开一个(新的)节点
                  • 等等...
                  • Ah, we move up one level, so we close the <Flag> first... Oops, there's nothing to write...
                  • Now there is something for <Flag>, which is not open anymore, we have to re-open a (new) <Flag> node
                  • and so on...

                  这篇关于如何在 SQL 中拆分具有相同子子名称的两个 xml 标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:XML 数据类型方法“修改"的错误使用.在这种情 下一篇:XQuery 存在检查选择 sql 查询

                  相关文章

                  最新文章

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

                • <small id='a1Jic'></small><noframes id='a1Jic'>

                    <bdo id='a1Jic'></bdo><ul id='a1Jic'></ul>

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