TSQL - Parsing XML Help, searching for specific value

tsxuljmkag

New Member
Can anyone help me with the correct TSQL to parse the following xml. Say i wanted to find the item with a value of "y" for the name element, but i want to get the value of of "value" element, which is "2" in the example below.\[code\]Declare @XML xmlset @XML ='<Test><items><item><name>x</name><value>1</value></item><item><name>y</name><value>2</value></item></items></Test>'--i am stuck hereselecct @XML.value('Test/items/....")\[/code\]Result would be "2" by searching for "y".Is this possible?can someone help with the syntax? thanks!
 
Back
Top