且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在 SQL Server 2008 中查询 XML 列

更新时间:2022-06-03 22:29:51

要选择具有您提到的条件的所有行,请尝试以下选择语句:

To select all rows which have the criteria you mentioned, try this select statement:

SELECT * 
FROM dbo.YourXmlTable
WHERE
YourXmlTable.xml_col.value('(//Attribute[@id=7])[1]', 'decimal') = 1.0
AND 
    YourXmlTable.xml_col.value('(//Attribute[@id=8])[1]', 'varchar(10)') = 'AAA'

对于 XML 索引,请阅读在线书籍 如何创建它们以及如何使用它们.

For XML indices, read up on Books Online how to create them and how to use them.