pbootcms网站模板|日韩1区2区|织梦模板||网站源码|日韩1区2区|jquery建站特效-html5模板网

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

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

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

    <tfoot id='XGFzc'></tfoot>
      <bdo id='XGFzc'></bdo><ul id='XGFzc'></ul>

        如何在 SQL 語句中將變量傳遞到 XQuery 的 XPath

        How to pass a variable into XPath of XQuery in an SQL statement(如何在 SQL 語句中將變量傳遞到 XQuery 的 XPath)
          <tbody id='z84DJ'></tbody>

            <bdo id='z84DJ'></bdo><ul id='z84DJ'></ul>
          • <legend id='z84DJ'><style id='z84DJ'><dir id='z84DJ'><q id='z84DJ'></q></dir></style></legend>
                1. <i id='z84DJ'><tr id='z84DJ'><dt id='z84DJ'><q id='z84DJ'><span id='z84DJ'><b id='z84DJ'><form id='z84DJ'><ins id='z84DJ'></ins><ul id='z84DJ'></ul><sub id='z84DJ'></sub></form><legend id='z84DJ'></legend><bdo id='z84DJ'><pre id='z84DJ'><center id='z84DJ'></center></pre></bdo></b><th id='z84DJ'></th></span></q></dt></tr></i><div class="v7zb55d" id='z84DJ'><tfoot id='z84DJ'></tfoot><dl id='z84DJ'><fieldset id='z84DJ'></fieldset></dl></div>

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

                  <tfoot id='z84DJ'></tfoot>

                  本文介紹了如何在 SQL 語句中將變量傳遞到 XQuery 的 XPath的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  限時送ChatGPT賬號..

                  場景:我在 MSSQL 數據庫中有一個 xml 列,我必須使用 XQuery 解析該單元格的 XML 數據.

                  Scenario: I have an xml column in MSSQL database which I have to parse the XML data of that cell using XQuery .

                       Xml content : <AnchoredXml xmlns="urn:schema:Microsoft.Rtc.Management.ScopeFramework.2008" SchemaWriteVersion="2">
                    <Key ScopeClass="Global">
                      <SchemaId Namespace="urn:schema:Microsoft.Rtc.Management.Deploy.Topology.2008" ElementName="Topology" />
                      <AuthorityId Class="Host" InstanceId="00000000-0000-0000-0000-000000000000" />
                    </Key>
                    <Dictionary Count="1">
                      <Item>
                        <Key />
                        <Value Signature="b1ac04f7-d8f0-4300-86cf-fb2b3383536c">
                          <Topology xmlns="urn:schema:Microsoft.Rtc.Management.Deploy.Topology.2008">
                            <InternalDomains AllowAllDomains="false" DefaultDomain="ocsqa.com">
                              <InternalDomain Name="ocsqa.com" Authoritative="false" AllowSubDomains="false" />
                            </InternalDomains>
                            <Sites>
                              <CentralSite SiteId="1">
                                <Name>LyncSite</Name>
                                <Location />
                              </CentralSite>
                            </Sites>
                            <Clusters>
                  

                  這是該單元格中xml內容的一段數據.

                  This is a piece of data of the xml content in that one cell.

                  我使用下面的查詢來遍歷上面xml的節點:

                  I am using below query to traverse the nodes of above xml:

                  select @cluster = @Items.query('/DocItemSet/DocItem/Data/*[@SchemaWriteVersion="2"]/*[2]/*[1]/*[2]/*[1]/*[3]') 
                  

                  上述查詢的輸出是:

                      <p1:Cluster xmlns:p1="urn:schema:Microsoft.Rtc.Management.Deploy.Topology.2008" RequiresReplication="true" RequiresSetup="true" Fqdn="XXXX.ocsqa.com">
                    <p1:ClusterId SiteId="1" Number="1" />
                    <p1:Machine OrdinalInCluster="1" Fqdn=" XXXX.ocsqa.com">
                      <p1:NetInterface InterfaceSide="Primary" InterfaceNumber="1" IPAddress="0.0.0.0" />
                      <p1:NetInterface InterfaceSide="External" InterfaceNumber="1" IPAddress="0.0.0.0" />
                      <p1:NetInterface InterfaceSide="Pstn" InterfaceNumber="1" IPAddress="0.0.0.0" />
                    </p1:Machine>
                  </p1:Cluster>
                  <p2:Cluster xmlns:p2="urn:schema:Microsoft.Rtc.Management.Deploy.Topology.2008" RequiresReplication="true" RequiresSetup="true" Fqdn=" XXXX2.ocsqa.com">
                    <p2:ClusterId SiteId="1" Number="2" />
                    <p2:Machine OrdinalInCluster="1" Fqdn=" XXXX2.ocsqa.com">
                      <p2:NetInterface InterfaceSide="Primary" InterfaceNumber="1" IPAddress="0.0.0.0" />
                      <p2:NetInterface InterfaceSide="External" InterfaceNumber="1" IPAddress="0.0.0.0" />
                      <p2:NetInterface InterfaceSide="Pstn" InterfaceNumber="1" IPAddress="0.0.0.0" />
                    </p2:Machine>
                  </p2:Cluster>
                  <p3:Cluster xmlns:p3="urn:schema:Microsoft.Rtc.Management.Deploy.Topology.2008" RequiresReplication="true" RequiresSetup="true" Fqdn=" XXXX2.ocsqa.com">
                    <p3:ClusterId SiteId="1" Number="3" />
                    <p3:Machine OrdinalInCluster="1" Fqdn=" XXXX2.ocsqa.com" />
                  </p3:Cluster>
                  

                  現在使用下面提到的查詢:

                  Now using query mentioned as below :

                  select @fqdn = @cluster.value('(./*/*/@Fqdn)[1]','nvarchar(20)') Select @fqdn
                  

                  注意上面查詢中突出顯示的索引號.使用這個查詢,我們將能夠獲得第一個可用的 xml 集群,同樣我也想尋找其他集群.

                  Note the highlighted index no in above query. Using this query we will be able to achieve the first Cluster available in xml, similarly I wanted to look for other Clusters as well.

                  所以我想在 while 循環中使用這個查詢.為此,我必須傳遞一個變量而不是硬編碼的 int 值.類似于以下內容:

                  So I wanted to use this query in while loop. For which I have to pass a variable instead of hardcoded int value. Something similar as below :

                  select @fqdn = @cluster.value('(./*/*/@Fqdn)[sql:variable("@test")]','nvarchar(20)')
                  

                  我參考了一些帖子如何將 XPath 與 Oracle XMLTable 中的變量一起使用?http://www.jasonstrate.com/2011/01/xquery-for-the-non-expert-variable-use/

                  但我收到如下錯誤:

                  消息 2389,級別 16,狀態 1,第 35 行XQuery [value()]: 'value()' 需要一個單例(或空序列),找到類型為 'xdt:untypedAtomic *' 的操作數如何將變量傳遞到 SQL 語句的 XQuery 中?

                  Msg 2389, Level 16, State 1, Line 35 XQuery [value()]: 'value()' requires a singleton (or empty sequence), found operand of type 'xdt:untypedAtomic *' How to pass a variable into a XQuery of SQL statement?

                  推薦答案

                  你需要告訴 SQL Server 你只對單個節點感興趣.在末尾添加 [1].

                  You need to tell SQL Server that you are only interested in the a single node. Add a [1] at the end.

                  @cluster.value('(./*/*/@Fqdn)[sql:variable("@test")][1]','nvarchar(20)')
                  

                  這篇關于如何在 SQL 語句中將變量傳遞到 XQuery 的 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 移動到文件存儲)
                  <legend id='tRrTY'><style id='tRrTY'><dir id='tRrTY'><q id='tRrTY'></q></dir></style></legend>
                    <tbody id='tRrTY'></tbody>
                  <tfoot id='tRrTY'></tfoot>

                      • <bdo id='tRrTY'></bdo><ul id='tRrTY'></ul>

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

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

                            主站蜘蛛池模板: 物和码官网,物和码,免费一物一码数字化营销SaaS平台 | 成都中天自动化控制技术有限公司| 耐火砖厂家,异形耐火砖-山东瑞耐耐火材料厂 | 变色龙云 - 打包app_原生app_在线制作平台_短链接_ip查询 | 搜木网 - 木业全产业链交易平台,免费搜货、低价买货! | 合肥抖音SEO网站优化-网站建设-网络推广营销公司-百度爱采购-安徽企匠科技 | 天津中都白癜风医院_天津白癜风医院_天津治疗白癜风 | 百度关键词优化_网站优化_SEO价格 - 云无限好排名 | 深圳3D打印服务-3D打印加工-手板模型加工厂-悟空打印坊 | 氟塑料磁力泵-不锈钢离心泵-耐腐蚀化工泵厂家「皖金泵阀」 | 瑞典Blueair空气净化器租赁服务中心-专注新装修办公室除醛去异味服务! | 热工多功能信号校验仪-热电阻热电偶校验仿真仪-金湖虹润仪表 | 压力控制器,差压控制器,温度控制器,防爆压力控制器,防爆温度控制器,防爆差压控制器-常州天利智能控制股份有限公司 | 酒瓶_酒杯_玻璃瓶生产厂家_徐州明政玻璃制品有限公司 | 哈希PC1R1A,哈希CA9300,哈希SC4500-上海鑫嵩实业有限公司 | 客服外包专业服务商_客服外包中心_网萌科技 | pbootcms网站模板|织梦模板|网站源码|jquery建站特效-html5模板网 | 美国PARKER齿轮泵,美国PARKER柱塞泵,美国PARKER叶片泵,美国PARKER电磁阀,美国PARKER比例阀-上海维特锐实业发展有限公司二部 | 广东西屋电气有限公司-广东西屋电气有限公司 | 手术室净化厂家_成都实验室装修公司_无尘车间施工单位_洁净室工程建设团队-四川华锐16年行业经验 | 温州中研白癜风专科_温州治疗白癜风_温州治疗白癜风医院哪家好_温州哪里治疗白癜风 | 减速机_上海宜嘉减速机| 精益专家 - 设备管理软件|HSE管理系统|设备管理系统|EHS安全管理系统 | 挤出机_橡胶挤出机_塑料挤出机_胶片冷却机-河北伟源橡塑设备有限公司 | 不锈钢酒柜|恒温酒柜|酒柜定制|酒窖定制-上海啸瑞实业有限公司 | 湖南自考_湖南自学考试网 | 开云(中国)Kaiyun·官方网站-登录入口 | 杭州标识标牌|文化墙|展厅|导视|户内外广告|发光字|灯箱|铭阳制作公司 - 杭州标识标牌|文化墙|展厅|导视|户内外广告|发光字|灯箱|铭阳制作公司 | 变色龙PPT-国内原创PPT模板交易平台 - PPT贰零 - 西安聚讯网络科技有限公司 | 北京包装设计_标志设计公司_包装设计公司-北京思逸品牌设计 | 膜结构_ETFE膜结构_膜结构厂家_膜结构设计-深圳市烨兴智能空间技术有限公司 | RFID电子标签厂家-上海尼太普电子有限公司 | 【德信自动化】点胶机_全自动点胶机_自动点胶机厂家_塑料热压机_自动螺丝机-深圳市德信自动化设备有限公司 | 采暖炉_取暖炉_生物质颗粒锅炉_颗粒壁炉_厂家加盟批发_烟台蓝澳采暖设备有限公司 | 广州中央空调回收,二手中央空调回收,旧空调回收,制冷设备回收,冷气机组回收公司-广州益夫制冷设备回收公司 | 喷播机厂家_二手喷播机租赁_水泥浆洒布机-河南青山绿水机电设备有限公司 | 颚式破碎机,圆锥破碎机,制砂机-新乡市德诚机电制造有限公司 | 紧急泄压人孔_防爆阻火器_阻火呼吸阀[河北宏泽石化] | 垃圾处理设备_餐厨垃圾处理设备_厨余垃圾处理设备_果蔬垃圾处理设备-深圳市三盛环保科技有限公司 | 粉末冶金-粉末冶金齿轮-粉末冶金零件厂家-东莞市正朗精密金属零件有限公司 | 电动高压冲洗车_价格-江苏速利达机车有限公司 |