Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

FOR XML EXPLICIT

0 views
Skip to first unread message

Goran Djuranovic

unread,
Jan 24, 2008, 11:32:44 AM1/24/08
to
Hi all,
Is it possible to manipulate the order of child elements within a parent element?
 
For example, the following code:

Select Distinct

    1 As Tag,

    Null As Parent,

    Practice.PracticeID As [Practice!1!PracticeID!ELEMENT],

    Null As [Contact!2!LastName!ELEMENT],

    Null As [Contact!2!FirstName!ELEMENT],

    Practice.Phone As [Practice!1!Phone!ELEMENT]

From Practice

For Xml Explicit

    ... blah, blah ...

 

will always generate:

<Practice>

  <PracticeID>32</PracticeID>

  <Phone>(111) 111-1111</Phone>

  <Contact>

    <LastName>Fancy</LastName>

    <FirstName>Bob</FirstName>

  </Contact>

</Practice>

 

BUt , I want this: 

<Practice>

  <PracticeID>32</PracticeID>

  <Contact>

    <LastName>Fancy</LastName>

    <FirstName>Bob</FirstName>

  </Contact>

  <Phone>(111) 111-1111</Phone>

</Practice>

 

Thanks in advance.

Goran Djuranovic

 

Goran Djuranovic

unread,
Jan 24, 2008, 12:32:45 PM1/24/08
to
OK, I figured one way I could do it is to "Union All" another "Select" statement with "Phone" element in it, only. This would put it at the end of element list, under a parent element.
 
Goran
0 new messages