XQUERY in SQL Server : FLWOR examples

In this article, I am going to show you the uses of FLOWR statements in Microsoft sqlserver. I am going to show the uses by several examples. I am going to use the below xml to show the examples.


  <Nation code="10860" name="TOTALE ITALIA">

    <Agent code="10851" name="BIORCI">

      <Province code="10722" name="BS" />

      <Province code="10723" name="BZ" />

      <Province code="10724" name="MN" />

      <Province code="10725" name="TN" />

      <Province code="10726" name="VR" />


    <Agent code="10852" name="BRUNETTI">

      <Province code="10727" name="BA" />

      <Province code="10728" name="BR" />


    <Agent code="10853" name="DIECI">

      <Province code="10729" name="MB" />

      <Province code="10730" name="MI" />


    <Agent code="10854" name="FERRAROLI">

      <Province code="10731" name="RM" />


    <Agent code="10855" name="FRATAMICO">

      <Province code="10732" name="PD" />

      <Province code="10733" name="PN" />

      <Province code="10734" name="TV" />

      <Province code="10735" name="VE" />

      <Province code="10736" name="VI" />


    <Agent code="10856" name="GIACOMELLI">

      <Province code="10737" name="FI" />

      <Province code="10738" name="LI" />

      <Province code="10739" name="LU" />

      <Province code="10740" name="PI" />

      <Province code="10741" name="PO" />

      <Province code="10742" name="PT" />


    <Agent code="110851" name="BIORCI">

      <Province code="10758" name="BS" />

      <Province code="10760" name="BZ" />

      <Province code="10796" name="MN" />

      <Province code="10835" name="TN" />

      <Province code="10847" name="VR" />


    <Agent code="110852" name="BRUNETTI">

      <Province code="10752" name="BA" />


    <Agent code="110853" name="DIECI">

      <Province code="10792" name="MB" />

      <Province code="10795" name="MI" />


    <Agent code="110854" name="FERRAROLI">

      <Province code="10824" name="RM" />


    <Agent code="110855" name="FRATAMICO">

      <Province code="10811" name="PN" />

      <Province code="10840" name="TV" />

      <Province code="10845" name="VE" />

      <Province code="10846" name="VI" />


    <Agent code="110856" name="GIACOMELLI">

      <Province code="10777" name="FI" />

      <Province code="10788" name="LI" />

      <Province code="10791" name="LU" />

      <Province code="10810" name="PI" />

      <Province code="10812" name="PO" />

      <Province code="10816" name="PT" />


  </Nation Programming Solution | SQL Server 2005 Tutorial | SQL Server 2005 Useful Articles | Java Script Tutorial | Java Script Useful Articles | CSS Tutorial | CSS Useful Articles -->