sql server - Combine XML from T-SQL -


I have two separate table televisions and receivers which I am using XML path commands so that the XML is closed . My problem is that I want to add the output of my TV XML build with my receiver XML build to create an XML output.

So something happens to me (which allows me to keep the TV and receiver different tags within the filter data route):

  & lt; Filter Data & gt; & Lt; TV & gt; & Lt; TV & gt; & Lt; Type & gt; LCD & lt; / Type & gt; & Lt; Brand & gt; Samsung & lt; / Brand & gt; & Lt; / TV & gt; & Lt; TV & gt; & Lt; Type & gt; LCD & lt; / Type & gt; & Lt; Brand & gt; Panasonic & lt; / Brand & gt; & Lt; / TV & gt; & Lt; / TV & gt; & Lt; Receiver & gt; & Lt; Receiver & gt; & Lt; Type & gt; Ground 7.1 & lt; / Type & gt; & Lt; Brand & gt; Onkyo & lt; / Brand & gt; & Lt; / Receiver & gt; & Lt; Receiver & gt; & Lt; Type & gt; Ground 7.1 & lt; / Type & gt; & Lt; Brand & gt; Denon & lt; / Brand & gt; & Lt; / Receiver & gt; & Lt; / Receiver & gt; & Lt; / FilterData & gt;  

The problem is that when I create my query to output this XML

  select type, from brand to dbo.TVs XML path ('TV'), route ('TVS') type  

and

  select type, debob from brand. The receiver for the XML path ('receiver'), the root ('receiver') TYPE  

I'm not sure how to combine these examples to see:

  & lt; Filter Data & gt; & Lt; TV & gt; & Lt; TV & gt; & Lt; Type & gt; LCD & lt; / Type & gt; & Lt; Brand & gt; Samsung & lt; / Brand & gt; & Lt; / TV & gt; & Lt; TV & gt; & Lt; Type & gt; LCD & lt; / Type & gt; & Lt; Brand & gt; Panasonic & lt; / Brand & gt; & Lt; / TV & gt; & Lt; / TV & gt; & Lt; Receiver & gt; & Lt; Receiver & gt; & Lt; Type & gt; Ground 7.1 & lt; / Type & gt; & Lt; Brand & gt; Onkyo & lt; / Brand & gt; & Lt; / Receiver & gt; & Lt; Receiver & gt; & Lt; Type & gt; Ground 7.1 & lt; / Type & gt; & Lt; Brand & gt; Denon & lt; / Brand & gt; & Lt; / Receiver & gt; & Lt; / Receiver & gt;  

Use:

  SELECT (SELECT t.type, t.brand FROM dbo.TVs for XML file (TV), root ('TVS'), elements, TYPE), (SELECT r.type, r.brand FROM dbo Tested for the XML path ('receiver'), the root ('receivers', elements, type), using the  

for the receiver XML path ('Filter Data'): < All options 'LCD' AS type as 'LCD' AS type, 'Samsung' brand UniS as selection in the form of TV with / p>

 , 'Panasonic' AA Brands), select the brand union as 'receiver' (select 'Ground 7.1' AS type, 'OKAYO', select all 'GH 7.1,' 'Denon') (type TTP, From the receiver for the TXT TM XML Path ('TV'), Root ('TVS'), Elements, Type), (SELECT XML Path ('FilterData') from TV, RPMM XML path (' Receiver '), R / S>  
for root (' receiver '), elements, type)

Comments

Popular posts from this blog

Eclipse CDT variable colors in editor -

AJAX doesn't send POST query -

wpf - Custom Message Box Advice -