Bookmarks

Yahoo Gmail Google Facebook Delicious Twitter Reddit Stumpleupon Myspace Digg

Search queries

Use of assignment to $[ is deprecated at /usr/local/sbin/apxs line 86. , wwwxxx vim, mysql closing table and opening table, 800c5000, setgid operation not permitted, pciehp: acpi_pciehprm on IBM, WWWXXX.DBF, 078274121, info0a ip, should prodicers of software_based services be held liable or not liable for economic injuries

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