On 3?16?, ??8?57?, creed1 <cre...@discussions..microsoft.com> wrote:
> I need to generate an XML document that takes the following format. The
> format has already been defined by a separate application.
>
> <Opportunity>
> <Name>Example Name</Name>
> <Customer Id="A">
> <Name>Some Customer</Name>
> </Customer>
> <TotalValue>50.000</TotalValue>
> </Opportunity>
>
> My query would look something like this...
>
> select
> 1 as Tag,
> 0 as Parent,
> name as [Opportunity!1!Name!element],
> custid as [Customer!2!Id],
> custname as [Customer!2!Name!element],
> totval as [Opportunity!1!TotalValue!element]
> ...
>
> I can't seem to get the Customer element in the correct position. It always
> seems to float to the bottom of the document before the </Opportunity> tag.
> Can FOR XML EXPLICIT be used to generate this document?
I am sure,you need post your DDL :)