xquery_在SQL Server中使用XQuery更新XML的不同方法

xquery

XQuery is a query language for XML. XML is a markup language that provides software and hardware-independent way of storing, transporting, and sharing data. In this case, XML documents are stored in a SQL Server database. XQuery is used to manipulate, find and extract information stored in the XML format. It’s analogous to SQL for databases.

XQuery是XML的查询语言。 XML是一种标记语言,它提供独立于软件和硬件的方式来存储,传输和共享数据。 在这种情况下,XML文档存储在SQL Server数据库中。 XQuery用于处理,查找和提取以XML格式存储的信息。 它类似于数据库SQL。

In this article, we’ll introduce different ways to find and replace XML data using SQL Server XQuery.

在本文中,我们将介绍使用SQL Server XQuery查找和替换XML数据的不同方法。

Edit XML Document

Previously, a developer would update XML information by replacing the full XML document in the table column where it resided. But in the latest versions of SQL Server, we can use the XML modify() function in XQuery to update the XML data type column. We’ll look at both the old and new ways to query and update the data.

以前,开发人员将通过替换其所在的表列中的完整XML文档来更新XML信息。 但是在最新版本SQL Server中,我们可以在XQuery中使用XML Modify()函数来更新XML数据类型列。 我们将研究查询和更新数据的旧方法和新方法。

Refer to the sample table below, called user_details. It has an XML data type column labeled xml_data, and each row has an XML document containing detailed information. For user_id = 1, the value of the fname key is “Jo.” We will update the same row using different methods.

请参阅下面的示例表,名为user_details。 它有一个标记为xml_data的XML数据类型列,每一行都有一个包含详细信息的XML文档。 对于user_id = 1fname键的值为“ Jo”。 我们将使用不同的方法更新同一行。

XML Data typed column

替换XML文档 (Replace XML document

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值