Hi All,
I have two separate tables TVs and Receivers that I am using the FOR XML PATH commands to build XML off of. My issue is that I want to combine the output of my TV XML Build with my Receiver XML Build to create one XML output.
So I would have something like this(Which allows me to keep the TVs and Receivers Tags Separate within the FilterData Root):
<FilterData>
<TVs>
<TV>
<Type>LCD</Type>
<Brand>Samsung</Brand>
</TV>
<TV>
<Type>LCD</Type>
<Brand>Panasonic</Brand>
</TV>
</TVs>
<Receivers>
<Receiver>
<Type>Surround 7.1</Type>
<Brand>Onkyo</Brand>
</Receiver>
<Receiver>
<Type>Surround 7.1</Type>
<Brand>Denon</Brand>
</Receiver>
</Receivers>
</FilterData>
The problem is that when I build my queries to output this XML
Select
Type
,Brand
From dbo.TVs
FOR XML PATH('TV'),ROOT('TVS') TYPE
AND
Select
Type
,Brand
From dbo.Receivers
FOR XML PATH('Receiver'),ROOT('Receivers') TYPE
I am not sure how to combine these to look like the example:
<FilterData>
<TVs>
<TV>
<Type>LCD</Type>
<Brand>Samsung</Brand>
</TV>
<TV>
<Type>LCD</Type>
<Brand>Panasonic</Brand>
</TV>
</TVs>
<Receivers>
<Receiver>
<Type>Surround 7.1</Type>
<Brand>Onkyo</Brand>
</Receiver>
<Receiver>
<Type>Surround 7.1</Type>
<Brand>Denon</Brand>
</Receiver>
</Receivers>
Any thoughts would be greatly appreciated.
Thanks,
S