久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

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

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

        <legend id='VcyRU'><style id='VcyRU'><dir id='VcyRU'><q id='VcyRU'></q></dir></style></legend>
      1. 使用 SQL 在 XML 中插入節點

        Inserting node in XML using SQL(使用 SQL 在 XML 中插入節點)
        <tfoot id='N5Ca5'></tfoot>
          <tbody id='N5Ca5'></tbody>
        <i id='N5Ca5'><tr id='N5Ca5'><dt id='N5Ca5'><q id='N5Ca5'><span id='N5Ca5'><b id='N5Ca5'><form id='N5Ca5'><ins id='N5Ca5'></ins><ul id='N5Ca5'></ul><sub id='N5Ca5'></sub></form><legend id='N5Ca5'></legend><bdo id='N5Ca5'><pre id='N5Ca5'><center id='N5Ca5'></center></pre></bdo></b><th id='N5Ca5'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='N5Ca5'><tfoot id='N5Ca5'></tfoot><dl id='N5Ca5'><fieldset id='N5Ca5'></fieldset></dl></div>

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

      2. <legend id='N5Ca5'><style id='N5Ca5'><dir id='N5Ca5'><q id='N5Ca5'></q></dir></style></legend>

                • <bdo id='N5Ca5'></bdo><ul id='N5Ca5'></ul>
                  本文介紹了使用 SQL 在 XML 中插入節點的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  限時送ChatGPT賬號..

                  我有以下 XML:

                  創建表#temp(cid int,xml_data xml)插入 cid值(1001,'<主><name>''John doe''</name><年齡>15</年齡></主要>')

                  我想根據一個簡單的參數條件向這個 XML 添加一個額外的節點:

                  所需的輸出:

                  <name>John doe</name><type>Q</type><年齡>15</年齡></主要>

                  代碼:

                  select case when @type = 'Q' then更新#tempSET Main.modify('insert  into(/主要的)')走

                  我收到語法錯誤.任何幫助!

                  更新:

                  我在代碼中實施了建議的解決方案,但出現以下錯誤.錯過了一些愚蠢的東西!

                   更新 #temp設置 xml_data =案件當@type = 'G'然后 xml_data.modify('insert G into (/Main)[1]');當@type = 'Q'然后 xml_data.modify('insert Q into (/Main)[1]');結尾

                  我收到'XML 數據類型方法'修改'的錯誤使用.在這種情況下需要一個非突變方法.錯誤

                  解決方案

                  不需要任何復雜的麻煩.只需根據需要插入所需的節點:

                  UPDATE #temp SET xml_data.modify('insert Q into (/Main)[1]');

                  使用 as firstas lastbefore/after 允許您指定節點的位置.下面將新節點直接放在 之后:

                  UPDATE #temp SET xml_data.modify('insert Q after (/Main/name)[1]');

                  更新您關于更新語句的問題

                  你的陳述有幾個缺陷:

                  <塊引用>

                  更新#temp設置 xml_data =案件當@type = 'G'然后 xml_data.modify('insert G into (/Main)[1]');當@type = 'Q'然后 xml_data.modify('insert Q into (/Main)[1]');結尾

                  您不能使用語法 SET xmlColumn = xmlColumn.modify().您必須使用 SET xmlColumn.modify(),而且分號無論如何都會破壞這一點.

                  老實說,我覺得這很復雜,試試這個:

                  DECLARE @type VARCHAR(1)='Q'UPDATE #temp SET xml_data.modify('insert {sql:variable("@type")} into (/Main)[1]');

                  這將創建一個新節點 content</type>,其中的內容從變量 @type 中取出.

                  I have the below XML:

                  create table #temp(cid int,xml_data xml)
                  insert into cid
                  values(1001,
                       '<Main>
                          <name>''John doe''</name>
                          <age>15</age>
                      </Main>')
                  

                  I want to add an additional node to this XML based on a simple parametric condition:

                  desired output:

                  <Main>
                      <name>John doe</name>
                      <type>Q</type>
                      <age>15</age>
                  </Main>
                  

                  code:

                  select case when @type = 'Q' then
                      UPDATE #temp
                      SET Main.modify('insert <type = 'Q'> into 
                          (/Main)')
                      GO
                  

                  I am getting syntax error. Any help!

                  UPDATE:

                  I implemented the suggested solution in my code and I'm getting below error. Missing out something silly!

                   UPDATE #temp
                           SET xml_data = 
                              case
                                  when @type = 'G' 
                                  then xml_data.modify('insert <type>G</type> into (/Main)[1]');
                                  when @type = 'Q' 
                                  then xml_data.modify('insert <type>Q</type> into (/Main)[1]'); end
                  

                  I am getting 'Incorrect use of the XML data type method 'modify'. A non-mutator method is expected in this context.' error

                  解決方案

                  No need for any complicated hassel. Just insert the node you want as you want it:

                  UPDATE #temp SET xml_data.modify('insert <type>Q</type> into (/Main)[1]');
                  

                  Using as first, as last or before / after allows you to specify the node's position. The following will place the new node directly after <name>:

                  UPDATE #temp SET xml_data.modify('insert <type>Q</type> after (/Main/name)[1]');
                  

                  UPDATE Your question about an update-statement

                  Your statement has several flaws:

                  UPDATE #temp
                       SET xml_data = 
                          case
                              when @type = 'G' 
                              then xml_data.modify('insert <type>G</type> into (/Main)[1]');
                              when @type = 'Q' 
                              then xml_data.modify('insert <type>Q</type> into (/Main)[1]'); 
                           end
                  

                  You cannot use the syntax SET xmlColumn = xmlColumn.modify(). You have to use SET xmlColumn.modify(), Furthermore the semicolons are breaking this anyway.

                  To be honest, I think this is to complicated, try this:

                  DECLARE @type VARCHAR(1)='Q'
                  UPDATE #temp SET xml_data.modify('insert <type>{sql:variable("@type")}</type> into (/Main)[1]');
                  

                  This will create a new node <type>content</type>, with a content taken out ot the variable @type.

                  這篇關于使用 SQL 在 XML 中插入節點的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  SQL query to get all products, categories and meta data woocommerce/wordpress(獲取所有產品、類別和元數據的 SQL 查詢 woocommerce/wordpress)
                  Can I figure out a list of databases and the space used by SQL Server instances without writing SQL queries?(我可以在不編寫 SQL 查詢的情況下找出數據庫列表和 SQL Server 實例使用的空間嗎?) - IT屋-程序員軟件開發
                  How to create a login to a SQL Server instance?(如何創建對 SQL Server 實例的登錄?)
                  How to know the version and edition of SQL Server through registry search(如何通過注冊表搜索知道SQL Server的版本和版本)
                  Why do I get a quot;data type conversion errorquot; with ExecuteNonQuery()?(為什么會出現“數據類型轉換錯誤?使用 ExecuteNonQuery()?)
                  How to show an image from a DataGridView to a PictureBox?(如何將 DataGridView 中的圖像顯示到 PictureBox?)

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

                    <legend id='D0Ddp'><style id='D0Ddp'><dir id='D0Ddp'><q id='D0Ddp'></q></dir></style></legend>
                      <bdo id='D0Ddp'></bdo><ul id='D0Ddp'></ul>

                        <tbody id='D0Ddp'></tbody>

                      1. <tfoot id='D0Ddp'></tfoot>
                      2. <i id='D0Ddp'><tr id='D0Ddp'><dt id='D0Ddp'><q id='D0Ddp'><span id='D0Ddp'><b id='D0Ddp'><form id='D0Ddp'><ins id='D0Ddp'></ins><ul id='D0Ddp'></ul><sub id='D0Ddp'></sub></form><legend id='D0Ddp'></legend><bdo id='D0Ddp'><pre id='D0Ddp'><center id='D0Ddp'></center></pre></bdo></b><th id='D0Ddp'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='D0Ddp'><tfoot id='D0Ddp'></tfoot><dl id='D0Ddp'><fieldset id='D0Ddp'></fieldset></dl></div>
                          1. 主站蜘蛛池模板: 久久伊人精品 | 国产精品久久久久久久久久免费看 | 黄色av网站在线观看 | 久久aⅴ乱码一区二区三区 亚洲国产成人精品久久久国产成人一区 | 中文字幕99| 91视频在线看 | 国产伦一区二区三区久久 | 日韩精品一区二区三区久久 | 久久小视频 | www.xxxx欧美 | 久热精品在线观看视频 | 91久久精品一区二区二区 | 欧美日韩1区 | 99久久精品免费看国产四区 | 亚洲综合在线一区 | 日韩欧美在线视频播放 | 毛片在线免费 | 久久99精品久久久久久狂牛 | 精品一区二区三区在线观看 | 婷婷综合网| 精品成人69xx.xyz | 91精品国产综合久久久密闭 | 国产成人精品a视频一区www | 日本不卡免费新一二三区 | 91免费看片| 久久精品黄色 | 成人免费视频一区 | 久久99精品久久久久久琪琪 | 国内久久 | 国产中文字幕在线 | 久久久久国产 | 成人免费在线播放视频 | 密室大逃脱第六季大神版在线观看 | 91精品国产91久久久久久 | 国产福利91精品一区二区三区 | 久久99精品视频 | 欧美日韩在线成人 | 午夜欧美 | 欧美日韩精品在线免费观看 | 一本色道精品久久一区二区三区 | 午夜免费|