Sunday, February 19, 2012

How to query data type of XML?

I want to query XML datas.

I have one table T.this T has two columns,id int , datasXML xml.

the datasXML has some XML datas, there into one data is:

<root>
<item val="true"></item>
<others ... />
</root>

Now,I want to query this table's datasXML column,and root/item value is true.

How to design this SQL string?

SELECT * FROM T WHERE datasXML = "<root>.." -- or other?

Please give me some samples.thanks!

Ray Lynn

In SQL2005, XQuery is great for this. There are several good articles on MSDN, for example:

http://msdn.microsoft.com/library/en-us/dnsql90/html/sql2k5_xqueryintro.asp?frame=true

|||Thank you very much!!!!!!!!!!!!!!

No comments:

Post a Comment