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

<tfoot id='LahRf'></tfoot>

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

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

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

      1. 如何返回 SQL Server XPath 中存在的值?

        How to return the value that exists in SQL Server XPath?(如何返回 SQL Server XPath 中存在的值?)
        <legend id='yKpHY'><style id='yKpHY'><dir id='yKpHY'><q id='yKpHY'></q></dir></style></legend>
          <bdo id='yKpHY'></bdo><ul id='yKpHY'></ul>
          <i id='yKpHY'><tr id='yKpHY'><dt id='yKpHY'><q id='yKpHY'><span id='yKpHY'><b id='yKpHY'><form id='yKpHY'><ins id='yKpHY'></ins><ul id='yKpHY'></ul><sub id='yKpHY'></sub></form><legend id='yKpHY'></legend><bdo id='yKpHY'><pre id='yKpHY'><center id='yKpHY'></center></pre></bdo></b><th id='yKpHY'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='yKpHY'><tfoot id='yKpHY'></tfoot><dl id='yKpHY'><fieldset id='yKpHY'></fieldset></dl></div>
              <tbody id='yKpHY'></tbody>

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

            <tfoot id='yKpHY'></tfoot>

                1. 本文介紹了如何返回 SQL Server XPath 中存在的值?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  限時送ChatGPT賬號..

                  Stackoverflow 上的某個地方有一個問題,雖然我現在找不到了,但它提醒發布者 .value 不會返回 .exist s 的值.

                  There is a question somewhere on Stackoverflow, although i cannot find it now, that reminded the poster that .value does not return the value that .exists.

                  那是因為 .value 總是寫成要求 [1] 項,其中 .exist 到處可見.

                  That is because .value is always written as asking for the [1] item, where .exist looks everywhere.

                  假設一個包含兩個客戶的 xml 文檔:

                  Given a hypothetical xml document containing two customers:

                  <Customer>
                      <Name>Ian Boyd</Name>
                      <IDInfo>
                          <IDType>1</IDType>
                      </IDInfo>
                  </Customer>
                  <Customer>
                      <Name>Kirsten</Name>
                      <IDInfo>
                          <IDType>3</IDType>
                          <IDOtherDescription>Firearms Certificate</IDOtherDescription>
                      </IDInfo>
                  </Customer>
                  

                  我想為具有 IDType 的任何客戶返回 NameIDTypeIDOtherDescription3(其他):

                  i want to return the Name, IDType, and IDOtherDescription for any customers who have an IDType of 3 (Other):

                  DECLARE @xml XML;
                  SET @xml = 
                  '<Customer>
                      <Name>Ian Boyd</Name>
                      <IDInfo>
                          <IDType>1</IDType>
                      </IDInfo>
                  </Customer>
                  <Customer>
                      <Name>Kirsten</Name>
                      <IDInfo>
                          <IDType>3</IDType>
                          <IDOtherDescription>Firearms Certificate</IDOtherDescription>
                      </IDInfo>
                  </Customer>'
                  --Wrap it up in a table, cause it makes it look more like my real situation
                  ;WITH BatchReports AS (
                      SELECT @xml AS BatchFileXml
                  )
                  SELECT
                      BatchFileXml.value('(//Name)[1]', 'varchar(50)') AS Name,
                      BatchFileXml.value('(//IDType)[1]', 'varchar(50)') AS IDType,
                      BatchFileXml.value('(//IDOtherDescription)[1]', 'varchar(50)') AS IDOtherDescription,
                      *
                  FROM BatchReports
                  --WHERE BatchFileXml.value('(//IDType)[1]', 'varchar(50)') = '3'
                  WHERE BatchFileXml.exist('//IDType[text()="3"]')=1
                  

                  由于 .exist is 滿足,所以返回一行:

                  Since the .exist is satisfied, it returns a row:

                  Name     IDType IDOtherDescription
                  -------- ------ --------------------
                  Ian Boyd      1 Firearms Certificate
                  

                  除非那不是我想要的.我想要 IDType = 3 的值.

                  Except that's not what i wanted. I wanted the values where IDType = 3.

                  事情變得更加復雜,其中有多個 IDType 條目:

                  Things get even more complicated, where there are multiple IDType entries:

                  <Customer>
                      <Name>Ian Boyd</Name>
                      <IDInfo>
                          <IDType>1</IDType>
                      </IDInfo>
                  </Customer>
                  <Customer>
                      <Name>Kirsten</Name>
                      <IDInfo>
                          <IDType>1</IDType>
                      </IDInfo>
                      <IDInfo>
                          <IDType>2</IDType>
                      </IDInfo>
                      <IDInfo>
                          <IDType>4</IDType>
                      </IDInfo>
                      <IDInfo>
                          <IDType>3</IDType>
                          <IDOtherDescription>Firearms Certificate</IDOtherDescription>
                      </IDInfo>
                  </Customer>
                  

                  當您可以在其他級別找到 /IDInfo 節點時,情況會更加復雜:

                  And even more complicated when you can find /IDInfo nodes in other levels:

                  <Customer>
                      <Name>Ian Boyd</Name>
                      <IDInfo>
                          <IDType>1</IDType>
                      </IDInfo>
                      <ThirdPartyInfo>
                         <IDInfo>
                          <IDType>3</IDType>
                              <IDOtherDescription>Sherrif Badge</IDOtherDescription>
                         </IDInfo>
                      </ThirdPartyInfo>
                  </Customer>
                  <Customer>
                      <Name>Kirsten</Name>
                      <IDInfo>
                          <IDType>1</IDType>
                      </IDInfo>
                      <IDInfo>
                          <IDType>2</IDType>
                      </IDInfo>
                      <IDInfo>
                          <IDType>4</IDType>
                      </IDInfo>
                      <IDInfo>
                          <IDType>3</IDType>
                          <IDOtherDescription>Firearms Certificate</IDOtherDescription>
                      </IDInfo>
                  </Customer>
                  

                  最終結果是一樣的.我需要一個查詢來返回 existvalues:

                  The end result is the same. I need a query to return the values that exist:

                  Name     IDType IDOtherDescription
                  -------- ------ --------------------
                  Ian Boyd      3 Sherrif Badge
                  Kirsten       3 Firearms Certificate
                  

                  獎金聊天

                  當我兩年前設計系統并選擇使用 XML 數據類型時,我認為在緊急情況下它會很有用.我可以使用一些 XPath 來過濾原始 xml.我忘記了 XPath 和 SQL Server 中的 XPath 是多么不可能.四個小時盯著文檔和網站;我又餓又累.

                  Bonus Chatter

                  When i designed the system two years ago, and chose to use XML data type, i figured it would be useful when there's an emergency. I can use some XPath to filter through the raw xml. I forgot how impossible XPath, and XPath in SQL Server is. Four hours of staring at documentation and web-sites; i'm hungry and tired.

                  推薦答案

                  以下是您可以嘗試的查詢:

                  Here is the query you can try:

                  ;WITH BatchReports AS (
                      SELECT @xml AS BatchFileXml
                  )
                  SELECT a.BatchXml.value('(Name)[1]', 'varchar(50)') AS Name,
                      a.BatchXml.value('(IDInfo/IDType)[1]', 'varchar(50)') AS IDType,
                      a.BatchXml.value('(IDInfo/IDOtherDescription)[1]', 'varchar(50)') AS IDOtherDescription
                  FROM BatchReports b
                  CROSS APPLY b.BatchFileXml.nodes('Customer') A(BatchXml)
                  WHERE a.BatchXml.exist('IDInfo/IDType[text()=3]')=1
                  

                  這里是從所有 XML 中檢索必要信息的查詢.

                  and here is the query which retrieve necessary information form all of the XMLs.

                  ;WITH BatchReports AS (
                      SELECT @xml AS BatchFileXml
                  )
                  SELECT A.BatchXml.value('(Name)[1]', 'varchar(50)') AS Name,
                      B.BatchXml.value('(IDType)[1]', 'varchar(50)') AS IDType,
                      B.BatchXml.value('(IDOtherDescription)[1]', 'varchar(50)') AS IDOtherDescription
                  FROM BatchReports X
                  CROSS APPLY X.BatchFileXml.nodes('Customer') A(BatchXml)
                  CROSS APPLY A.BatchXml.nodes('//IDInfo') B(BatchXml)
                  WHERE A.BatchXml.exist('IDInfo/IDType[text()=3]')=1
                      AND B.BatchXml.exist('IDType[text()=3]')=1
                  

                  這篇關于如何返回 SQL Server XPath 中存在的值?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

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

                  相關文檔推薦

                  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?)
                  WinForms application design - moving documents from SQL Server to file storage(WinForms 應用程序設計——將文檔從 SQL Server 移動到文件存儲)
                    <tbody id='rs4H2'></tbody>
                    • <bdo id='rs4H2'></bdo><ul id='rs4H2'></ul>

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

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

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

                            主站蜘蛛池模板: 日韩av.com | 亚洲一区二区三区视频 | 午夜一区二区三区在线观看 | 国产视频91在线 | 男人天堂手机在线视频 | 欧美一级二级视频 | 国产成人午夜精品影院游乐网 | 成人毛片视频免费 | 一区二区在线不卡 | 国产精品福利视频 | 国产福利视频在线观看 | 欧美亚洲国产日韩 | 久久国产亚洲 | 国产精品一区二区三区免费观看 | 亚洲高清视频在线 | 久久丝袜视频 | 91视频网址 | 亚洲天堂色 | a中文在线视频 | 免费在线观看一区二区三区 | 免费在线观看毛片 | 蜜桃视频在线观看免费视频网站www | 日本精品一区二区三区视频 | wwww.8888久久爱站网 | 亚洲欧洲中文日韩 | 岛国视频| 福利精品 | 国产在线精品一区二区三区 | 伊人免费在线观看 | 国产午夜影院 | 日韩成人在线观看 | 国产精品久久久精品 | 亚洲精品乱码久久久久久9色 | 日韩美女一区二区三区在线观看 | 亚洲国产电影 | 欧美成人猛片aaaaaaa | 日韩电影a | 人人人干 | 国产黄视频在线播放 | 91欧美精品 | 久在线 |