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

      <bdo id='9lwVb'></bdo><ul id='9lwVb'></ul>
    <tfoot id='9lwVb'></tfoot>

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

    <small id='9lwVb'></small><noframes id='9lwVb'>

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

    1. 創建 XML 文件時在 SQL 中聯合

      Union in SQL while creating XML file(創建 XML 文件時在 SQL 中聯合)

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

              <tbody id='flxYX'></tbody>

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

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

              <tfoot id='flxYX'></tfoot>

              • <legend id='flxYX'><style id='flxYX'><dir id='flxYX'><q id='flxYX'></q></dir></style></legend>
              • 本文介紹了創建 XML 文件時在 SQL 中聯合的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                問題描述

                限時送ChatGPT賬號..

                我在創建 XML 文件的 SQL 查詢中遇到了一些問題.我想做 UNION 它這個查詢,但它不起作用.

                I got some problem with my SQL query which create a XML file. I want to do UNION it this query but it doesn't work.

                (SELECT 1 AS "ns0:kindOfItem",
                code AS "ns0:wholeCode",
                REPLACE(weight, ',', '.') AS "ns0:weight",
                1 AS "ns0:ammountOfNumbers",
                (SELECT price AS "ns0:value",
                'EUR' as "ns0:currency"
                FOR XML PATH ('ns0:sendedItems'), TYPE),
                (SELECT 
                'EUR' as "ns0:currency"
                FOR XML PATH ('ns0:present'), TYPE)
                FROM [PL].[dbo].[dk_documents] where id in (1,2,3)
                FOR XML PATH('test'))
                

                這個查詢工作正常,但是當我嘗試像這里這樣執行 UNION 時:

                This query works fine but when I try to do UNION like here:

                (SELECT 1 AS "ns0:kindOfItem",
                code AS "ns0:wholeCode",
                REPLACE(weight, ',', '.') AS "ns0:weight",
                1 AS "ns0:ammountOfNumbers",
                (SELECT price AS "ns0:value",
                'EUR' as "ns0:currency"
                FOR XML PATH ('ns0:sendedItems'), TYPE),
                (SELECT 
                'EUR' as "ns0:currency"
                FOR XML PATH ('ns0:present'), TYPE)
                FROM [PL].[dbo].[dk_documents] where id in (1,2,3)
                
                UNION
                
                (SELECT 1 AS "ns0:kindOfItem",
                code AS "ns0:wholeCode",
                REPLACE(weight, ',', '.') AS "ns0:weight",
                1 AS "ns0:ammountOfNumbers",
                (SELECT price AS "ns0:value",
                'EUR' as "ns0:currency"
                FOR XML PATH ('ns0:sendedItems'), TYPE),
                (SELECT 
                'EUR' as "ns0:currency"
                FOR XML PATH ('ns0:present'), TYPE)
                FROM [PL2].[dbo].[dk_documents] where id in (1,2,3)
                FOR XML PATH('test'))
                

                這個查詢給我一個錯誤:

                This query give me an error:

                數據類型 xml 不能用作 UNION、INTERSECT 的操作數或 EXCEPT 運算符,因為它沒有可比性.

                The data type xml cannot be used as an operand to the UNION, INTERSECT or EXCEPT operators because it is not comparable.

                推薦答案

                您可能對此感興趣:

                請比較以下內容

                測試"一詞出現在兩個列表中.UNION 會隱式地做一個 DISTINCT,所以test"只出現一次.

                The word "test" occurs in both lists. UNION will do a DISTINCT implicitly, so "test" appears only once.

                SELECT * 
                FROM (VALUES('this'),('is'),('a'),('test')) AS tbl(Words)
                UNION
                SELECT * 
                FROM (VALUES('and'),('another'),('test')) AS tbl(Words);
                

                UNION ALL一樣會讓test"出現兩次

                The same with UNION ALL will let the "test" appear twice

                SELECT * 
                FROM (VALUES('this'),('is'),('a'),('test')) AS tbl(Words)
                UNION ALL
                SELECT * 
                FROM (VALUES('and'),('another'),('test')) AS tbl(Words);
                

                您可以將 UNION SELECT 放入周圍的 SELECT(UNIONUNION ALL 并設置FOR XML PATH 用于整個結果集

                You can put your UNION SELECT into a surrounding SELECT (either UNION or UNION ALL and set the FOR XML PATH for the whole result-set

                命名空間重復創建,沒有錯,但是很煩(見這個:https://stackoverflow.com/a/35648751/5089204 和鏈接的連接文章)

                The namespace is created repeatedly, not wrong, but annoying (see this: https://stackoverflow.com/a/35648751/5089204 and the linked Connect-Article)

                WITH XMLNAMESPACES(DEFAULT 'Dummy') 
                SELECT *
                FROM
                (
                    SELECT * 
                    FROM (VALUES('this'),('is'),('a'),('test')) AS tbl(Words)
                    UNION
                    SELECT * 
                    FROM (VALUES('and'),('another'),('test')) AS tbl(Words)
                ) AS MetaTable
                FOR XML Path(''),ROOT('UNION_TEST');
                

                這將帶回兩個列表,每個列表都在它自己的 XML 標簽中,還有重復的命名空間(見之前)

                This will bring back both lists, each in its own XML tag, also repeated namespace (see before)

                WITH XMLNAMESPACES(DEFAULT 'Dummy') 
                SELECT
                 (
                    SELECT * 
                    FROM (VALUES('this'),('is'),('a'),('test')) AS tbl(Words)
                    FOR XML PATH(''),ROOT('FirstBlock'),TYPE
                 )
                ,(
                    SELECT * 
                    FROM (VALUES('and'),('another'),('test')) AS tbl(Words)
                    FOR XML PATH(''),ROOT('FirstBlock'),TYPE
                 )
                FOR XML Path(''),ROOT('UNION_TEST');
                

                最后你也可以使用它(無論是否使用ALL):

                And finally you can use this too (either with ALL or not):

                WITH XMLNAMESPACES(DEFAULT 'Dummy') 
                SELECT * 
                FROM (VALUES('this'),('is'),('a'),('test')) AS tbl(Words)
                UNION ALL
                SELECT * 
                FROM (VALUES('and'),('another'),('test')) AS tbl(Words)
                FOR XML PATH(''),ROOT('UNION_TEST');
                

                這篇關于創建 XML 文件時在 SQL 中聯合的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持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?)

              • <legend id='ytugc'><style id='ytugc'><dir id='ytugc'><q id='ytugc'></q></dir></style></legend>

                          <tbody id='ytugc'></tbody>

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

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

                        • 主站蜘蛛池模板: 国产精品视频久久 | aaa国产精品 | 国产午夜免费视频 | 国产一区视频在线 | 免费国产精品视频 | 四虎三级 | 午夜国产 | 国产精品久久久久久久久久久久午夜片 | 天天插天天狠天天透 | 91视频免费观看 | 国产精品区二区三区日本 | 日韩一级大片 | 97中文字幕 | 99热国产在线| 欧美日本在线观看 | 久久黄色免费视频 | 神马午夜视频 | 天天操免费视频 | 中文字幕亚洲一区 | 宅男噜噜噜66一区二区 | 亚洲最大黄色网址 | 国产精品美女 | 国产成人精品三级麻豆 | 黄色一级大片在线免费看国产一 | 国产一区二区三区在线看 | 国产高清免费 | 伊人精品在线 | 国产成人区 | 久久性生活视频 | 三级av片 | 亚洲欧美日韩成人 | 97精品在线视频 | 色天堂视频| 欧美在线 | 九九热精品在线观看 | 免费三级网站 | 国产成年妇视频 | 五月婷婷综合激情 | 好色影院| 久久久久久久 | 午夜av福利 |