久久久久久久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. 創(chuàng)建 XML 文件時在 SQL 中聯(lián)合

      Union in SQL while creating XML file(創(chuàng)建 XML 文件時在 SQL 中聯(lián)合)

        <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>
              • 本文介紹了創(chuàng)建 XML 文件時在 SQL 中聯(lián)合的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                問題描述

                限時送ChatGPT賬號..

                我在創(chuàng)建 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'))
                

                這個查詢工作正常,但是當我嘗試像這里這樣執(zhí)行 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:

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

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

                推薦答案

                您可能對此感興趣:

                請比較以下內(nèi)容

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

                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"出現(xiàn)兩次

                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

                命名空間重復創(chuàng)建,沒有錯,但是很煩(見這個: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');
                

                這篇關于創(chuàng)建 XML 文件時在 SQL 中聯(lián)合的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

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

                相關文檔推薦

                SQL query to get all products, categories and meta data woocommerce/wordpress(獲取所有產(chǎn)品、類別和元數(shù)據(jù)的 SQL 查詢 woocommerce/wordpress)
                Can I figure out a list of databases and the space used by SQL Server instances without writing SQL queries?(我可以在不編寫 SQL 查詢的情況下找出數(shù)據(jù)庫列表和 SQL Server 實例使用的空間嗎?) - IT屋-程序員軟件開發(fā)
                How to create a login to a SQL Server instance?(如何創(chuàng)建對 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()?(為什么會出現(xiàn)“數(shù)據(jù)類型轉換錯誤?使用 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>

                        • 主站蜘蛛池模板: 国产精品久久久久久久岛一牛影视 | 国产精品精品视频一区二区三区 | 91精品国产综合久久久久久丝袜 | 毛片.com | www.久久久.com| 欧美操操操 | www久| 久久毛片网站 | 五月婷婷激情网 | 精品国产31久久久久久 | 国产日韩一区二区三免费高清 | 成人免费观看男女羞羞视频 | 成人深夜小视频 | 精品国产欧美一区二区三区成人 | 99久久99 | 一区二区三区四区在线视频 | 欧美日韩精品一区二区 | 亚洲成人精品国产 | 中文一区 | 午夜视频一区二区 | 激情欧美一区二区三区中文字幕 | 中文字幕综合 | 亚洲一区二区三区在线播放 | 久国产精品 | 国产激情 | 日本在线黄色 | 久久机热 | 中文字幕亚洲视频 | 国产91丝袜在线18 | 日韩一区二区三区视频在线播放 | 精品国产精品一区二区夜夜嗨 | 久久久久久久久久久久久久av | 免费的色网站 | 成人精品影院 | av天天操| www.99热这里只有精品 | 日本黄色大片免费看 | 国产精品美女在线观看 | 欧美日韩专区 | 欧美精品一区二区三 | 久久久久1|