在 SQL 查询中检测 XML nil
我正在使用 MS SQL Server 2008。我有一个 XML 类型的列,用于存储某些序列化的结果。当被序列化的对象的值为 nothing
/null
时,此结果存储在数据库中,
<StaticModifiedProduct xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xsi:nil="true" />
我正在构建一个查询,需要确定数据是否在XML 列表示是否为空对象。所以换句话来说,区分列什么时候有上面的值,或者是序列化的对象。
SQL Server 2008 中是否有内置的 XML 功能可以做到这一点?
I'm using MS SQL Server 2008. I have a column of type XML that I am storing the result of some serialization. When the value of the object being serialized is nothing
/null
this result is stored in the database,
<StaticModifiedProduct xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xsi:nil="true" />
I am building a query that needs to determine whether or not the data in the XML column represents a null object or not. So in other words, distinguish when the column has the above value, or a serialized object.
Is there any built in XML functionality in SQL Server 2008 that can do this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
下面是从顶级项读取 xsi:nil 属性的示例:
Here's an example to read the xsi:nil attribute from the top-level item: