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

<tfoot id='DO5zK'></tfoot>

    1. <small id='DO5zK'></small><noframes id='DO5zK'>

    2. <i id='DO5zK'><tr id='DO5zK'><dt id='DO5zK'><q id='DO5zK'><span id='DO5zK'><b id='DO5zK'><form id='DO5zK'><ins id='DO5zK'></ins><ul id='DO5zK'></ul><sub id='DO5zK'></sub></form><legend id='DO5zK'></legend><bdo id='DO5zK'><pre id='DO5zK'><center id='DO5zK'></center></pre></bdo></b><th id='DO5zK'></th></span></q></dt></tr></i><div class="7vhzprh" id='DO5zK'><tfoot id='DO5zK'></tfoot><dl id='DO5zK'><fieldset id='DO5zK'></fieldset></dl></div>

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

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

        如何使用 XML 數據更新 SQL 表列

        How to update a SQL table column with XML data(如何使用 XML 數據更新 SQL 表列)
        <i id='fRdxF'><tr id='fRdxF'><dt id='fRdxF'><q id='fRdxF'><span id='fRdxF'><b id='fRdxF'><form id='fRdxF'><ins id='fRdxF'></ins><ul id='fRdxF'></ul><sub id='fRdxF'></sub></form><legend id='fRdxF'></legend><bdo id='fRdxF'><pre id='fRdxF'><center id='fRdxF'></center></pre></bdo></b><th id='fRdxF'></th></span></q></dt></tr></i><div class="vhhhbhn" id='fRdxF'><tfoot id='fRdxF'></tfoot><dl id='fRdxF'><fieldset id='fRdxF'></fieldset></dl></div>
        <tfoot id='fRdxF'></tfoot>

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

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

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

                    <tbody id='fRdxF'></tbody>
                  本文介紹了如何使用 XML 數據更新 SQL 表列的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  限時送ChatGPT賬號..

                  表 1:

                  id      title               chtml
                  0       Lopez, Michelle MD  <root><StartOne><Value1>Lopez, Michelle MD</Value1><Value2>Spanish</Value2><Value3><a title="49 west point" href="myloc.aspx?id=56" target="_blank">49 west point</a></Value3><Value4>908-783-0909</Value4><Value5><a title="CM" href="myspec.aspx?id=78" target="_blank">CM</a></Value5></StartOne></root>
                  1       Michael, Jogn, MD   <root><StartOne><Value1>Michael, Jogn, MD</Value1><Value2>English</Value2><Value3><a title="99 show drive" href="myloc.aspx?id=05" target="_blank">99 show drive</a></Value3><Value4>908-783-0909</Value4><Value5><a title="KM" href="myspec.aspx?id=40 target="_blank">KM</a></Value5></StartOne></root>
                  

                  chtmlntext 類型,id 0:

                  The chtml is of type ntext for id 0:

                  <root>
                      <StartOne>
                          <Value1>Lopez, Michelle MD</Value1>
                          <Value2>Spanish</Value2>
                          <Value3>
                              <a title="49 west point" href="myloc.aspx?id=56" target="_blank">49 west point</a>
                          </Value3>
                          <Value4>908-783-0909</Value4>
                          <Value5>
                              <a title="CM" href="myspec.aspx?id=78" target="_blank">CM</a>
                          </Value5>
                      </StartOne>
                  </root>
                  

                  chtmlntext 類型,id 1:

                  The chtml is of type ntext for id 1:

                  <root>
                      <StartOne>
                          <Value1>Michael, Jogn, MD</Value1>
                          <Value2>English</Value2>
                          <Value3>
                              <a title="99 show drive" href="myloc.aspx?id=05" target="_blank">99 show drive</a>
                          </Value3>
                          <Value4>908-783-0909</Value4>
                          <Value5>
                              <a title="KM" href="myspec.aspx?id=40 target="_blank">KM</a></Value5>
                          </Value5>
                      </StartOne>
                  </root>
                  

                  Table 2Table 3 包含用于為鏈接 Url、標題和值創建 Table 1 的數據:

                  Table 2 and Table 3 has data which is used in the creation of Table 1 for the link Url, title, and value:

                  Table 2:
                  
                      id              title
                      ---------------------------------
                      56              49 west point
                      90              130 chester lane
                      12              320 nolan street
                      05              99 show drive
                  
                  Table 3:
                  
                      id              description
                      ------------------------------
                      78              CM
                      39              IM
                      40              KM
                  

                  Table 4 包含更新后的數據,用于更新 Table 1 值:

                  Table 4 has the updated data which will be used to update Table 1 values:

                  Table 4:
                  
                      Name                    Value2              Value3                  Value4              Value5
                      --------------------------------------------------------------------------------------------------------------
                      Lopez, Michelle MD      English             130 chester lane        908-783-0909        KM
                      Michael, Jogn, MD       Italian             320 nolan street        540-029-2090        IM
                  

                  我正在嘗試使用以下查詢來更新其中一個值:

                  I am trying the following query to update one of the value:

                  declare @xml xml;
                  select @xml = cast([content_html] as xml)
                  from [myDB1].[dbo].[Table 1]
                  
                  set @xml.modify('
                    replace value of (/root/StartOne/Value3/text())[1]
                    with "<a title="{Value3 from Table 4}" href="myloc.aspx?id={ID from Table 2 that matches the title with the title from Table 4}" target="_blank">{Value3 from Table 4}</a>"
                  ');
                  
                  -- How can I update the anchor link values of one table by querying another table data.
                  -- How can I update multiple fields, for Example `Value3` and `Value5`?
                  
                  update [myDB1].[dbo].[Table 1]
                  set [content_html] = cast(@xml as nvarchar(max))
                  where [content_title] = 'Lopez, Michelle MD'
                  

                  一個例子是:

                  declare @xml xml;
                  select @xml = cast([content_html] as xml)
                  from [myDB1].[dbo].[Table 1]
                  
                  set @xml.modify('
                    replace value of (/root/StartOne/Value3/text())[1]
                    with "<a title="130 chester lane" href="myloc.aspx?id=90" target="_blank">130 chester lane</a>"
                  ');
                  
                  update [myDB1].[dbo].[Table 1]
                  set [content_html] = cast(@xml as nvarchar(max))
                  where [content_title] = 'Lopez, Michelle MD'
                  

                  表一(以上更新后):

                  id      title               chtml
                  0       Lopez, Michelle MD  <root><StartOne><Value1>Lopez, Michelle MD</Value1><Value2>Spanish</Value2><Value3><a title="130 chester lane" href="myloc.aspx?id=90" target="_blank">130 chester lane</a></Value3><Value4>908-783-0909</Value4><Value5><a title="CM" href="myspec.aspx?id=78" target="_blank">CM</a></Value5></StartOne></root>
                  1       Michael, Jogn, MD   <root><StartOne><Value1>Michael, Jogn, MD</Value1><Value2>English</Value2><Value3><a title="99 show drive" href="myloc.aspx?id=05" target="_blank">99 show drive</a></Value3><Value4>908-783-0909</Value4><Value5><a title="KM" href="myspec.aspx?id=40 target="_blank">KM</a></Value5></StartOne></root>
                  

                  請幫助我解決以下問題:

                  Please help me with the following:

                  • 如何通過查詢更新一張表的錨鏈接值另一個表數據?
                  • 如何更新多個字段,例如 Value3Value5然后運行更新語句?
                  • How can I update the anchor link values of one table by querying another table data?
                  • How can I update multiple fields, for Example Value3 and Value5 and then run the update statement?

                  推薦答案

                  這是解決問題的方法

                  declare @table4 table
                  (Name nvarchar(22), Value3 nvarchar(22))
                  
                      insert into @table4 values ('Lopez, Michelle MD' ,'130 chester lane')       
                      insert into @table4 values ('Michael, Jogn, MD ','320 nolan street') 
                  
                  declare @table1 table
                  (id int, title nvarchar(max), chtml ntext)
                  
                  
                  insert into @table1 values (0,'Lopez, Michelle MD',  '<root><StartOne><Value1>Lopez, Michelle MD</Value1><Value2>Spanish</Value2><Value3>
                  <a title="49 west point" href="myloc.aspx?id=56" target="_blank">49 west point</a></Value3><Value4>908-783-0909</Value4><Value5><a title="CM" href="myspec.aspx?id=78" target="_blank">CM</a></Value5></StartOne></root>')
                  insert into @table1 values (1,'Michael, Jogn, MD',   '<root><StartOne><Value1>Michael, Jogn, MD</Value1><Value2>English</Value2><Value3><a title="99 show drive" href="myloc.aspx?id=05" target="_blank">99 show drive</a></Value3><Value4>908-783-0909</Value4><Value5><a title="KM" href="myspec.aspx?id=40 target="_blank">KM</a></Value5></StartOne></root>')
                  
                  
                  declare @xml xml;
                  select top 1 @xml = cast(chtml as xml)
                  from @table1
                  
                  -- How can I update the anchor link values of one table by querying another table data.
                  declare @titl nvarchar(22)
                  select @titl = Value3 from @table4 where Name = 'Lopez, Michelle MD'
                  set @xml.modify('
                    replace value of (/root/StartOne/Value3/a/@title)[1]
                    with sql:variable("@titl")
                  ');
                  set @xml.modify('
                    replace value of (/root/StartOne/Value3/a/text())[1]
                    with sql:variable("@titl")
                  ');
                  
                  -- How can I update multiple fields, for Example `Value3` and `Value5`?
                  -- Answer: here you can modify Value5
                  
                  update @table1
                  set chtml = cast(@xml as nvarchar(max))
                  where id = 0
                  
                  select * from @table1
                  

                  這篇關于如何使用 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?)
                  <tfoot id='Csll5'></tfoot>
                  <i id='Csll5'><tr id='Csll5'><dt id='Csll5'><q id='Csll5'><span id='Csll5'><b id='Csll5'><form id='Csll5'><ins id='Csll5'></ins><ul id='Csll5'></ul><sub id='Csll5'></sub></form><legend id='Csll5'></legend><bdo id='Csll5'><pre id='Csll5'><center id='Csll5'></center></pre></bdo></b><th id='Csll5'></th></span></q></dt></tr></i><div class="jpxlb5v" id='Csll5'><tfoot id='Csll5'></tfoot><dl id='Csll5'><fieldset id='Csll5'></fieldset></dl></div>
                      <bdo id='Csll5'></bdo><ul id='Csll5'></ul>

                        1. <small id='Csll5'></small><noframes id='Csll5'>

                            <tbody id='Csll5'></tbody>
                        2. <legend id='Csll5'><style id='Csll5'><dir id='Csll5'><q id='Csll5'></q></dir></style></legend>

                          • 主站蜘蛛池模板: 铣床|万能铣床|立式铣床|数控铣床|山东滕州万友机床有限公司 | 3dmax渲染-效果图渲染-影视动画渲染-北京快渲科技有限公司 | 曙光腾达官网-天津脚手架租赁-木板架出租-移动门式脚手架租赁「免费搭设」 | 净化车间装修_合肥厂房无尘室设计_合肥工厂洁净工程装修公司-安徽盛世和居装饰 | 液压油缸-液压缸厂家价格,液压站系统-山东国立液压制造有限公司 液压油缸生产厂家-山东液压站-济南捷兴液压机电设备有限公司 | 电力电子产业网| 岛津二手液相色谱仪,岛津10A液相,安捷伦二手液相,安捷伦1100液相-杭州森尼欧科学仪器有限公司 | 蔬菜清洗机_环速洗菜机_异物去除清洗机_蔬菜清洗机_商用洗菜机 - 环速科技有限公司 | 污泥烘干机-低温干化机-工业污泥烘干设备厂家-焦作市真节能环保设备科技有限公司 | 压片机_高速_单冲_双层_花篮式_多功能旋转压片机-上海天九压片机厂家 | 铸铝门厂家,别墅大门庭院大门,别墅铸铝门铜门[十大品牌厂家]军强门业 | 珠海白蚁防治_珠海灭鼠_珠海杀虫灭鼠_珠海灭蟑螂_珠海酒店消杀_珠海工厂杀虫灭鼠_立净虫控防治服务有限公司 | 阿米巴企业经营-阿米巴咨询管理-阿米巴企业培训-广东键锋企业管理咨询有限公司 | 撕碎机,撕破机,双轴破碎机-大件垃圾破碎机厂家| 荣事达手推洗地机_洗地机厂家_驾驶式扫地机_工业清洁设备 | 硫化罐_蒸汽硫化罐_大型硫化罐-山东鑫泰鑫智能装备有限公司 | 蒜肠网-动漫,二次元,COSPLAY,漫展以及收藏型模型,手办,玩具的新媒体.(原变形金刚变迷TF圈) | MVR蒸发器厂家-多效蒸发器-工业废水蒸发器厂家-康景辉集团官网 | 喷砂机厂家_自动除锈抛丸机价格-成都泰盛吉自动化喷砂设备 | 耐破强度测试仪-纸箱破裂强度试验机-济南三泉中石单品站 | IIS7站长之家-站长工具-爱网站请使用IIS7站长综合查询工具,中国站长【WWW.IIS7.COM】 | 曙光腾达官网-天津脚手架租赁-木板架出租-移动门式脚手架租赁「免费搭设」 | 砂磨机_立式纳米砂磨机_实验室砂磨机-广州儒佳化工设备厂家 | 防爆鼓风机-全风-宏丰鼓风机-上海梁瑾机电设备有限公司 | 西安中国国际旅行社(西安国旅) | 除尘器布袋骨架,除尘器滤袋,除尘器骨架,电磁脉冲阀膜片,卸灰阀,螺旋输送机-泊头市天润环保机械设备有限公司 | 艾默生变频器,艾默生ct,变频器,ct驱动器,广州艾默生变频器,供水专用变频器,风机变频器,电梯变频器,艾默生变频器代理-广州市盟雄贸易有限公司官方网站-艾默生变频器应用解决方案服务商 | 质检报告_CE认证_FCC认证_SRRC认证_PSE认证_第三方检测机构-深圳市环测威检测技术有限公司 | 广州市哲铭油墨涂料有限公司,水性漆生产研发基地 | 对辊破碎机-液压双辊式,强力双齿辊,四辊破碎机价格_巩义市金联机械设备生产厂家 | 膜结构车棚|上海膜结构车棚|上海车棚厂家|上海膜结构公司 | 纯化水设备-纯水设备-超纯水设备-[大鹏水处理]纯水设备一站式服务商-东莞市大鹏水处理科技有限公司 | 自动螺旋上料机厂家价格-斗式提升机定制-螺杆绞龙输送机-杰凯上料机 | 深圳市八百通智能技术有限公司官方网站| 水厂污泥地磅|污泥处理地磅厂家|地磅无人值守称重系统升级改造|地磅自动称重系统维修-河南成辉电子科技有限公司 | 直齿驱动-新型回转驱动和回转支承解决方案提供商-不二传动 | 东莞螺杆空压机_永磁变频空压机_节能空压机_空压机工厂批发_深圳螺杆空压机_广州螺杆空压机_东莞空压机_空压机批发_东莞空压机工厂批发_东莞市文颖设备科技有限公司 | 济南侦探调查-济南调查取证-山东私家侦探-山东白豹调查咨询公司 密集架|电动密集架|移动密集架|黑龙江档案密集架-大量现货厂家销售 | 健康管理师报名入口,2025年健康管理师考试时间信息网-网站首页 塑料造粒机「厂家直销」-莱州鑫瑞迪机械有限公司 | 防水接头-电缆防水接头-金属-电缆密封接头-不锈钢电缆接头 | 中视电广_短视频拍摄_短视频推广_短视频代运营_宣传片拍摄_影视广告制作_中视电广 |