Bookmarks

Yahoo Gmail Google Facebook Delicious Twitter Reddit Stumpleupon Myspace Digg

Search queries

TheboL.wwwxxxxx, WWWXXXAPC , wwwxxn.xsss, wwwxxxapc, WWWXXX.VCBA, wwwxxx vba, wwwxxxdoco, Wwwxxx.APC, wwwxxx CN2, can't locate feature.pm in @inc (@inc contains

Links

XODOX
Impressum

#1: SQL 2005 XML Searching

Posted on 2008-04-16 07:11:38 by zzzxtreme

hi i have a table with an XML column

this XML data looks like this

<details><attribute id="1" value="x"/><attribute id="2" value="y"/
><attribute id="3" value="z"/></details>


could anyone help guide me on how to search something like this?

-------
Select * from Table Where (XMLColumn contains attribute of id="2" and
value like "y%")

Report this message

#2: Re: SQL 2005 XML Searching

Posted on 2008-04-16 16:28:20 by Plamen Ratchev

Here is one way:

SELECT keycol, datacol
FROM Foo
WHERE datacol.exist('/details/attribute[@id = "2"]') = 1
AND datacol.exist('/details/attribute[substring(@value, 1, 1) = "y"]') =
1;

HTH,

Plamen Ratchev
http://www.SQLStudio.com

Report this message