473,378 Members | 1,467 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

SQL 2005 XML Searching

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%")
Jun 27 '08 #1
1 1232
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

Jun 27 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Rare Book School | last post by:
RARE BOOK SCHOOL 2005 Rare Book School is pleased to announce its schedule of courses for 2005, including sessions at the University of Virginia, the Walters Art Museum/Johns Hopkins University...
6
by: sathyashrayan | last post by:
Following are the selected thread from the date:30-jan-2005 to 31-jan-2005. I did not use any name because of the subject is important. You can get the original thread by typing the subject...
7
by: Micheal | last post by:
Hi, I want to know about news groups of visual studio.net 2005 . regards micheal
0
by: Muhammad Shoaib | last post by:
Hello Everybody! I'm using vb.net 2005 and MSSQL Server 2000 as back end i have little problem while i want to show only the data which i want, it gievs me problem infact i want to place a select...
4
by: Max | last post by:
Hello, I live in Canada and I would like to get a copy of Visual Studio .NET 2005. I looked on Amazon and they don't ship to here and neither does Microsoft. I can't find any retailer that has VS...
4
by: kurt.kurtsmith | last post by:
I am trying to import a tlb from a COM server(exe) I wrote with the following statement: #import "C:\\em2\\EM\\src\\core\\UMOSEFax\\Debug\\UMOSEFax.tlb" no_namespace auto_search the tlh and...
3
by: Mark D Powell | last post by:
I attempted to upgrade my SQL Server 2000 Enterprise Edition (32 bit) to SQL Severer 2005 EE 32 bit and while the prereqs passed the installer will not let me select the version 8.00.x (2000 SP4)...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.