SQL Server Performance

XML Xquery Issue

Discussion in 'SQL Server 2005 General Developer Questions' started by hello.everyone.hello, Dec 12, 2006.

  1. Hi guys ,
    i'm some how a beginner to XML and i have a question

    suppose i have the following XML

    <league num="1">
    <clubs>
    <club num="1">Aresnal</club >
    <club num="2">Chelsa</club >
    <club num="3">Man utd</club >
    </clubs>
    </league >
    <league num="2">
    <clubs>
    <club num="1">Real</club >
    <club num="2">Barca</club >
    </clubs>
    </league>

    using Xml data type and xquery , how to get scalar value ,using xml.value , of all clubs with num="2"

    So , result should be

    result-------------------------------------------------------

    Chelsa

    barca





    Thanks in advance
  2. DilliGrg Member

    quote:Originally posted by hello.everyone.hello

    Hi guys ,
    i'm some how a beginner to XML and i have a question

    suppose i have the following XML

    <league num="1">
    <clubs>
    <club num="1">Aresnal</club >
    <club num="2">Chelsa</club >
    <club num="3">Man utd</club >
    </clubs>
    </league >
    <league num="2">
    <clubs>
    <club num="1">Real</club >
    <club num="2">Barca</club >
    </clubs>
    </league>

    using Xml data type and xquery , how to get scalar value ,using xml.value , of all clubs with num="2"

    So , result should be

    result-------------------------------------------------------

    Chelsa

    barca





    Thanks in advance



    Check this and other sites for OpenXML:
    http://www.sqlservercentral.com/columnists/rVasant/usingopenxml.asp

    Thanks,
    DilliGrg
  3. smy New Member

Share This Page