Wrox Programmer Forums
Go Back   Wrox Programmer Forums > SQL Server > SQL Server 2005 > SQL Server 2005
|
SQL Server 2005 General discussion of SQL Server *2005* version only.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server 2005 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 1st, 2009, 11:50 AM
Authorized User
 
Join Date: Sep 2009
Posts: 30
Thanks: 9
Thanked 0 Times in 0 Posts
Smile Get XML node values(SQL Server 2005)

Hello,

I have a XML column containing data like
few rows of the table
<Books>
<Authors><ID>10</ID><ID>20</ID><ID>30</ID><ID>40</ID>
<Authors>
</Books>


<Books>
<Authors><ID>10</ID><ID>20</ID><ID>30</ID>
<Authors>
</Books>


<Books>
<Authors><ID>10</ID><ID>40</ID>
<Authors>
</Books>


<Books>
<Authors><ID>20</ID><ID>40</ID>
<Authors>
</Books>


I would like to fetch the value 40 if and only if 10 is present in the XML column. but I should not pick up the value 20 or 30.
I dont know how many <ID></ID> nodes will be there in the data some times 1, 2, 3 or 4.
In the above case only 1st and 3rd row should give value 40.

Thanks in advance





Similar Threads
Thread Thread Starter Forum Replies Last Post
SQL Server 2005 XML: FOR XML PATH -> cdata? stoves SQL Server 2005 1 July 8th, 2008 02:40 AM
XML vs SQL Server 2005 yadavrahul2k5 XML 2 June 1st, 2008 02:59 AM
Aggreagation of leaf node values in BSM 2005 chary SharePoint Development 0 September 19th, 2007 06:43 AM
Transform SQL server 2005 XML with xslt bonekrusher XSLT 0 July 11th, 2007 07:45 PM
Looping through XML in SQL Server 2005 francislang SQL Server 2005 1 February 23rd, 2006 11:47 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.