5
Estoy tratando de crear el siguiente documento XML a partir de una consulta SQL 2005. Lo que estoy luchando con es que el documento tiene 3 nodos en el mismo nivel: Cliente, RepairFacility y Action. Se necesitacrear documentos XML a partir de la consulta SQL
--¿Qué
<Elements>
<Element>
<Customer>
<FirstName></FirstName>
<LastName></LastName>
</Customer>
<RepairFacility>
<LocationName></LocationName>
<LocationPhone></LocationPhone>
</RepairFacility>
<Action>
<FollowUpFlag></FollowUpFlag>
<DateAction></DateAction>
</Action>
</Element>
<Element>
</Element>
</Elements>
--Mi consulta
SELECT
( SELECT .....
FROM tbl A1
FOR XML PATH('Customer'), TYPE),
(SELECT ......
FROM tbl A2
FOR XML PATH('RepairFacility'), TYPE),
(SELECT .....
FROM tbl J
FOR XML PATH('Action'), TYPE )
FOR XML PATH(''), ROOT('Element')
--¿Qué consigo
<Elements>
<Element>
<Customer>
<FirstName></FirstName>
<LastName></LastName>
</Customer>
<Customer>
<FirstName></FirstName>
<LastName></LastName>
</Customer>
<RepairFacility>
<LocationName></LocationName>
<LocationPhone></LocationPhone>
</RepairFacility>
<RepairFacility>
<LocationName></LocationName>
<LocationPhone></LocationPhone>
</RepairFacility>
<Action>
<FollowUpFlag></FollowUpFlag>
<DateAction></DateAction>
</Action>
<Action>
<FollowUpFlag></FollowUpFlag>
<DateAction></DateAction>
</Action>
</Element>
<Element>
</Elements>
estoy agradecido por cualquier ayuda.
Works! Gracias Ryan –