久久久久久久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>

                        • 主站蜘蛛池模板: av夜夜操| 成人一级毛片 | 成人一区在线观看 | 亚洲一区在线播放 | 日韩精品在线观看视频 | 色综合天天综合网国产成人网 | 国色天香综合网 | 精品国产一区二区三区久久狼黑人 | 色啪网| www.一区二区三区.com | 日本又色又爽又黄的大片 | 色先锋影音 | 91在线影院 | 九九国产在线观看 | 在线播放国产一区二区三区 | 久久精品亚洲欧美日韩久久 | 久久精品国产一区二区电影 | 精品久久影院 | 亚洲国产成人精品久久久国产成人一区 | 久久久久国产成人精品亚洲午夜 | 九九色综合 | 国产一区二区在线免费播放 | 色播久久久 | 一区二区三区四区电影 | 粉嫩一区二区三区四区公司1 | 中文字幕av中文字幕 | 欧美自拍第一页 | 国产精品久久九九 | 中文字幕免费视频 | 久久久高清 | 四虎影院免费在线播放 | 成人亚洲精品久久久久软件 | 国产九九九 | 国产激情视频网 | 国产精品久久久久久高潮 | 电影午夜精品一区二区三区 | 亚洲精品中文字幕av | 91在线中文字幕 | 欧美精品99| 亚洲欧洲色视频 | 一区二区三区在线 |