Some XQuery/SQL Server 2005 help please

Discussion in 'XML' started by CK, Nov 27, 2006.

  1. CK

    CK Guest

    This query

    SELECT DeliveryList.query('declare default element namespace
    http://schemas.adventure-works.com/DeliverySchedule;
    <DeliveryRoute>
    <RouteNo>{ sql:column("D.DeliveryRoute") }</RouteNo>
    for a$ in /DeliveryList/Delivery/Address
    return
    <Address>a$</Address>
    </DeliveryRoute>')
    as Result
    FROM Sales.DeliverySchedule D

    Returns this XML

    <DeliveryRoute xmlns="http://schemas.adventure-works.com/DeliverySchedule">
    <RouteNo>3</RouteNo>
    for a$ in /DeliveryList/Delivery/Address
    return
    <Address>a$</Address></DeliveryRoute>

    I need it to return this XML
    <DeliveryRoute xmlns="http://schemas.adventure-works.com/DeliverySchedule>

    <RouteNo<3>/RouteNo>

    <Address>6126 North Sixth Street, Rockhampton</Address>

    <Address>6445 Cashew Street, Rockhampton</Address>

    </DeiveryRoute>



    What am I doing wrong? Any ideas? All help is appreciated.

    TIA, ~CK
     
    CK, Nov 27, 2006
    #1
    1. Advertising

  2. CK

    CK Guest

    Here is the original XML Doc
    <?xml version="1.0" ?>
    - <DeliveryList xmlns="http://schemas.adventure-works.com/DeliverySchedule">
    - <Delivery SalesOrderID="43659">
    <CustomerName>Steve Schmidt</CustomerName>
    <Address>6126 North Sixth Street, Rockhampton</Address>
    </Delivery>
    - <Delivery SalesOrderID="43660">
    <CustomerName>Tony Lopez</CustomerName>
    <Address>6445 Cashew Street, Rockhampton</Address>
    </Delivery>
    </DeliveryList>

    "CK" <> wrote in message
    news:DqHah.6841$...
    > This query
    >
    > SELECT DeliveryList.query('declare default element namespace
    > http://schemas.adventure-works.com/DeliverySchedule;
    > <DeliveryRoute>
    > <RouteNo>{ sql:column("D.DeliveryRoute") }</RouteNo>
    > for a$ in /DeliveryList/Delivery/Address
    > return
    > <Address>a$</Address>
    > </DeliveryRoute>')
    > as Result
    > FROM Sales.DeliverySchedule D
    >
    > Returns this XML
    >
    > <DeliveryRoute
    > xmlns="http://schemas.adventure-works.com/DeliverySchedule">
    > <RouteNo>3</RouteNo>
    > for a$ in /DeliveryList/Delivery/Address
    > return
    > <Address>a$</Address></DeliveryRoute>
    >
    > I need it to return this XML
    > <DeliveryRoute xmlns="http://schemas.adventure-works.com/DeliverySchedule>
    >
    > <RouteNo<3>/RouteNo>
    >
    > <Address>6126 North Sixth Street, Rockhampton</Address>
    >
    > <Address>6445 Cashew Street, Rockhampton</Address>
    >
    > </DeiveryRoute>
    >
    >
    >
    > What am I doing wrong? Any ideas? All help is appreciated.
    >
    > TIA, ~CK
    >
    >
    >
    >
     
    CK, Nov 27, 2006
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Juan T. Llibre
    Replies:
    0
    Views:
    482
    Juan T. Llibre
    Jun 7, 2005
  2. =?Utf-8?B?dmE=?=
    Replies:
    4
    Views:
    2,863
    =?Utf-8?B?dmE=?=
    Feb 22, 2006
  3. Tony Lavinio
    Replies:
    0
    Views:
    547
    Tony Lavinio
    Mar 2, 2005
  4. farseer

    SQL Server 2005 + SQL Server Express

    farseer, Aug 7, 2006, in forum: ASP .Net
    Replies:
    3
    Views:
    358
    farseer
    Aug 8, 2006
  5. CK

    Xquery Help Sql 2005

    CK, Nov 22, 2006, in forum: XML
    Replies:
    5
    Views:
    503
    oXygen XML Editor
    Nov 23, 2006
Loading...

Share This Page