Home > Archive > MS SQL XML > October 2005 > Query to get XML in output (SQL Server 2000)









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Query to get XML in output (SQL Server 2000)
Umar

2005-10-27, 9:26 am

Hi all,

Can anyone help me with a SQL query to get the following XMLs in result.
This is for SQL Server 2000

First XML

<TagA id="NR_2">
<TagB id="2">Factory</TagB>
<TagC>WASHINGTON</TagC>
<TagD>999999999</TagD>
<TagE id="123456">Other</TagE>
<TagF>
<TagG>COMPANY</TagG>
<TagH>0123</TagH>
</TagF>
</TagA>




Second XML

<TagA id="NR_3">
<TagB id="2">Factory</TagB>
<TagC>GEORGIA</TagC>
<TagD>GA</TagD>
<TagE id="123456">Other</TagE>
<TagF/>
</TagA>


Michael Rys [MSFT]

2005-10-27, 9:26 am

Look at the FOR XML EXPLICIT functionality.

If you could provide us with some example table, we could probably help you
with the query.

Best regards
Michael

"Umar" <Umar@discussions.microsoft.com> wrote in message
news:1F4BC4B9-186A-46D8-BFB0- BA0BD657B184@microso
ft.com...
> Hi all,
>
> Can anyone help me with a SQL query to get the following XMLs in result.
> This is for SQL Server 2000
>
> First XML
>
> <TagA id="NR_2">
> <TagB id="2">Factory</TagB>
> <TagC>WASHINGTON</TagC>
> <TagD>999999999</TagD>
> <TagE id="123456">Other</TagE>
> <TagF>
> <TagG>COMPANY</TagG>
> <TagH>0123</TagH>
> </TagF>
> </TagA>
>
>
>
>
> Second XML
>
> <TagA id="NR_3">
> <TagB id="2">Factory</TagB>
> <TagC>GEORGIA</TagC>
> <TagD>GA</TagD>
> <TagE id="123456">Other</TagE>
> <TagF/>
> </TagA>
>
>



Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com