Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Sql Server 2005 Xml Programming

Author  Topic 

sinureddy1
Starting Member

2 Posts

Posted - 2008-07-12 : 12:19:55
I have two select statements that give the output like
<Env>
<RegistryAddress>ABCD</RegistryAddress>
<UserName>ABCD1</UserName>
<Password>ABCD2</Password>
<RegisteredBusinessName>ABCD3</RegisteredBusinessName>
<MLTModelKey>ABCD4</MLTModelKey>
</Env>

And the second output is
<Contents>
<Content Name="ABCD">
<tModel Name="tmABCD">
<Descr>tmABCD</Descr>
<WSDLLocation />
<categories>
<category>
<KeyValue />
<KeyName></KeyName>
</category>
</categories>
</tModel>
<WebService>
<AccessPoint>ABCD/Test.aspx</AccessPoint>
<Descr>ABCD</Descr>
</WebService>
</Content>
<Content Name="ABCD1">
<tModel Name="tmABCD1">
<Descr>tmABCD1</Descr>
<WSDLLocation />
<categories>
<category>
<KeyValue />
<KeyName></KeyName>
</category>
</categories>
</tModel>
<WebService>
<AccessPoint>ABCD1/Test1.aspx</AccessPoint>
<Descr>>ABCD1</Descr>
</WebService>
</Content>
</Contents>

The first Sql Statement is
SELECT * FROM ENV
FOR XML PATH('Env'), TYPE

And the second Xml Stmt is a Select with 4 tables and joins.

What I want is a combination Xml like
<PUBGenConfig>
<Env>
<RegistryAddress>ABCD</RegistryAddress>
<UserName>ABCD1</UserName>
<Password>ABCD2</Password>
<RegisteredBusinessName>ABCD3</RegisteredBusinessName>
<MLTModelKey>ABCD4</MLTModelKey>
</Env>
<Contents>
<Content Name="ABCD">
<tModel Name="tmABCD">
<Descr>tmABCD</Descr>
<WSDLLocation />
<categories>
<category>
<KeyValue />
<KeyName></KeyName>
</category>
</categories>
</tModel>
<WebService>
<AccessPoint>ABCD/Test.aspx</AccessPoint>
<Descr>ABCD</Descr>
</WebService>
</Content>
<Content Name="ABCD1">
<tModel Name="tmABCD1">
<Descr>tmABCD1</Descr>
<WSDLLocation />
<categories>
<category>
<KeyValue />
<KeyName></KeyName>
</category>
</categories>
</tModel>
<WebService>
<AccessPoint>ABCD1/Test1.aspx</AccessPoint>
<Descr>>ABCD1</Descr>
</WebService>
</Content>
</Contents>
</PUBGenConfig>

sodeep
Master Smack Fu Yak Hacker

7174 Posts

Posted - 2008-07-12 : 12:29:06
so what is the question?
Go to Top of Page

sinureddy1
Starting Member

2 Posts

Posted - 2008-07-13 : 00:59:23
I want to know how to write the select statement that gives the combination Xml in Sql Server 2005.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-07-13 : 02:39:13
Look for FOR XML EXPLICIT in books online. Refer the below too

http://www.quest-pipelines.com/newsletter-v3/0502_B.htm

http://www.ianywhere.com/developer/product_manuals/sqlanywhere/0901/en/html/dbugen9/00000534.htm
Go to Top of Page
   

- Advertisement -