<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
		>
<channel>
	<title>Comments on: SQL SERVER &#8211; Simple Example of Creating XML File Using T-SQL</title>
	<atom:link href="http://blog.sqlauthority.com/2009/02/12/sql-server-simple-example-of-creating-xml-file-using-t-sql/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.sqlauthority.com/2009/02/12/sql-server-simple-example-of-creating-xml-file-using-t-sql/</link>
	<description>Personal Notes of Pinal Dave</description>
	<lastBuildDate>Sun, 26 May 2013 03:27:17 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
	<item>
		<title>By: SQL SERVER &#8211; Weekly Series &#8211; Memory Lane &#8211; #016 &#171; SQL Server Journey with SQL Authority</title>
		<link>http://blog.sqlauthority.com/2009/02/12/sql-server-simple-example-of-creating-xml-file-using-t-sql/#comment-422297</link>
		<dc:creator><![CDATA[SQL SERVER &#8211; Weekly Series &#8211; Memory Lane &#8211; #016 &#171; SQL Server Journey with SQL Authority]]></dc:creator>
		<pubDate>Sat, 16 Feb 2013 01:31:21 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=2464#comment-422297</guid>
		<description><![CDATA[[...] Simple Example of Creating XML File Using T-SQL [...]]]></description>
		<content:encoded><![CDATA[<p>[...] Simple Example of Creating XML File Using T-SQL [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Madina</title>
		<link>http://blog.sqlauthority.com/2009/02/12/sql-server-simple-example-of-creating-xml-file-using-t-sql/#comment-391920</link>
		<dc:creator><![CDATA[Madina]]></dc:creator>
		<pubDate>Wed, 12 Dec 2012 14:07:53 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=2464#comment-391920</guid>
		<description><![CDATA[GREAT THANKS!!!]]></description>
		<content:encoded><![CDATA[<p>GREAT THANKS!!!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Shilpi Kapoor</title>
		<link>http://blog.sqlauthority.com/2009/02/12/sql-server-simple-example-of-creating-xml-file-using-t-sql/#comment-343137</link>
		<dc:creator><![CDATA[Shilpi Kapoor]]></dc:creator>
		<pubDate>Wed, 12 Sep 2012 11:25:20 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=2464#comment-343137</guid>
		<description><![CDATA[how to get XML like below:

urn:epc:id:sgtin:1249612083.107346. 
 
urn:epc:id:sgtin:1249612083.107346.550006729 urn:epc:id:sgtin:1249612083.107346.550006730 urn:epc:id:sgtin:1249612083.107346.550006731 urn:epc:id:sgtin:1249612083.107346.550006732 urn:epc:id:sgtin:1249612083.107346.550006733 urn:epc:id:sgtin:1249612083.107346.550006734 urn:epc:id:sgtin:1249612083.107346.550006735 urn:epc:id:sgtin:1249612083.107346.550006736 urn:epc:id:sgtin:1249612083.107346.550006737 urn:epc:id:sgtin:1249612083.107346.550006738
]]></description>
		<content:encoded><![CDATA[<p>how to get XML like below:</p>
<p>urn:epc:id:sgtin:1249612083.107346. </p>
<p>urn:epc:id:sgtin:1249612083.107346.550006729 urn:epc:id:sgtin:1249612083.107346.550006730 urn:epc:id:sgtin:1249612083.107346.550006731 urn:epc:id:sgtin:1249612083.107346.550006732 urn:epc:id:sgtin:1249612083.107346.550006733 urn:epc:id:sgtin:1249612083.107346.550006734 urn:epc:id:sgtin:1249612083.107346.550006735 urn:epc:id:sgtin:1249612083.107346.550006736 urn:epc:id:sgtin:1249612083.107346.550006737 urn:epc:id:sgtin:1249612083.107346.550006738</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jesse</title>
		<link>http://blog.sqlauthority.com/2009/02/12/sql-server-simple-example-of-creating-xml-file-using-t-sql/#comment-341539</link>
		<dc:creator><![CDATA[Jesse]]></dc:creator>
		<pubDate>Thu, 06 Sep 2012 15:28:30 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=2464#comment-341539</guid>
		<description><![CDATA[Great post! Is there a way to mimic this output with SQL?


  
    
      Object Name
      Property
      
      Length of Title
      Right Padded with Spaces
      Length With Spaces
      
      
      
      
      
      Chart Color
      
    
	


I have only been able to get it to look like this:


  
    Object Namenot NameObject NameObject Name
  
]]></description>
		<content:encoded><![CDATA[<p>Great post! Is there a way to mimic this output with SQL?</p>
<p>      Object Name<br />
      Property</p>
<p>      Length of Title<br />
      Right Padded with Spaces<br />
      Length With Spaces</p>
<p>      Chart Color</p>
<p>I have only been able to get it to look like this:</p>
<p>    Object Namenot NameObject NameObject Name</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Pradeep K.</title>
		<link>http://blog.sqlauthority.com/2009/02/12/sql-server-simple-example-of-creating-xml-file-using-t-sql/#comment-341363</link>
		<dc:creator><![CDATA[Pradeep K.]]></dc:creator>
		<pubDate>Thu, 06 Sep 2012 06:18:19 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=2464#comment-341363</guid>
		<description><![CDATA[Hi Pinal Sir,
Ur RND is nice, but i cant understand how to execute it after creating XML link which shown above  at last image.. so please tell me what is next procedure  after creating XML link..  :)
 
Thanks and regards 
Pradeep K]]></description>
		<content:encoded><![CDATA[<p>Hi Pinal Sir,<br />
Ur RND is nice, but i cant understand how to execute it after creating XML link which shown above  at last image.. so please tell me what is next procedure  after creating XML link..  :)</p>
<p>Thanks and regards<br />
Pradeep K</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: João Luiz</title>
		<link>http://blog.sqlauthority.com/2009/02/12/sql-server-simple-example-of-creating-xml-file-using-t-sql/#comment-340631</link>
		<dc:creator><![CDATA[João Luiz]]></dc:creator>
		<pubDate>Mon, 03 Sep 2012 22:44:06 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=2464#comment-340631</guid>
		<description><![CDATA[Hi, Dave.

I&#039;m rewriting my question to (hopefully) include proper XML tags
 
I have a requirement such that there should be no self closing tags in an XML result I have to serve to another system.
 
If, for example, I do a query like this:…
 
SELECT ‘Fuit Shop’ AS ShopName
 ,” AS Nada
 ,(SELECT ‘Apple’ AS Fruits1
 ,’Pineapple’ AS Fruits2
 ,” AS Fruits3
 ,’Melon’ AS Fruits4
 FOR XML PATH(‘Fruits’), TYPE)
 FOR XML PATH(”), ROOT(‘SampleXML’)
 
… the result will be:

&lt;SampleXML&gt;
  &lt;ShopName&gt;Fuit Shop&lt;/ShopName&gt;
  &lt;Nada&gt;&lt;/Nada&gt;
  &lt;Fruits&gt;
    &lt;Fruits1&gt;Apple&lt;/Fruits1&gt;
    &lt;Fruits2&gt;Pineapple&lt;/Fruits2&gt;
    &lt;Fruits3 /&gt;
    &lt;Fruits4&gt;Melon&lt;/Fruits4&gt;
  &lt;/Fruits&gt;
&lt;/SampleXML&gt;
 
 Note that while element Nada has a separate closing tag, Fuit3 is self-closing.
 
How could I modify that query to meet my requirement and get a result as follows?:
 
&lt;SampleXML&gt;
  &lt;ShopName&gt;Fuit Shop&lt;/ShopName&gt;
  &lt;Nada&gt;&lt;/Nada&gt;
  &lt;Fruits&gt;
    &lt;Fruits1&gt;Apple&lt;/Fruits1&gt;
    &lt;Fruits2&gt;Pineapple&lt;/Fruits2&gt;
    &lt;Fruits3&gt;&lt;/Fruits3&gt;
    &lt;Fruits4&gt;Melon&lt;/Fruits4&gt;
  &lt;/Fruits&gt;
&lt;/SampleXML&gt;
 
Thank you, very much.]]></description>
		<content:encoded><![CDATA[<p>Hi, Dave.</p>
<p>I&#8217;m rewriting my question to (hopefully) include proper XML tags</p>
<p>I have a requirement such that there should be no self closing tags in an XML result I have to serve to another system.</p>
<p>If, for example, I do a query like this:…</p>
<p>SELECT ‘Fuit Shop’ AS ShopName<br />
 ,” AS Nada<br />
 ,(SELECT ‘Apple’ AS Fruits1<br />
 ,’Pineapple’ AS Fruits2<br />
 ,” AS Fruits3<br />
 ,’Melon’ AS Fruits4<br />
 FOR XML PATH(‘Fruits’), TYPE)<br />
 FOR XML PATH(”), ROOT(‘SampleXML’)</p>
<p>… the result will be:</p>
<p>&lt;SampleXML&gt;<br />
  &lt;ShopName&gt;Fuit Shop&lt;/ShopName&gt;<br />
  &lt;Nada&gt;&lt;/Nada&gt;<br />
  &lt;Fruits&gt;<br />
    &lt;Fruits1&gt;Apple&lt;/Fruits1&gt;<br />
    &lt;Fruits2&gt;Pineapple&lt;/Fruits2&gt;<br />
    &lt;Fruits3 /&gt;<br />
    &lt;Fruits4&gt;Melon&lt;/Fruits4&gt;<br />
  &lt;/Fruits&gt;<br />
&lt;/SampleXML&gt;</p>
<p> Note that while element Nada has a separate closing tag, Fuit3 is self-closing.</p>
<p>How could I modify that query to meet my requirement and get a result as follows?:</p>
<p>&lt;SampleXML&gt;<br />
  &lt;ShopName&gt;Fuit Shop&lt;/ShopName&gt;<br />
  &lt;Nada&gt;&lt;/Nada&gt;<br />
  &lt;Fruits&gt;<br />
    &lt;Fruits1&gt;Apple&lt;/Fruits1&gt;<br />
    &lt;Fruits2&gt;Pineapple&lt;/Fruits2&gt;<br />
    &lt;Fruits3&gt;&lt;/Fruits3&gt;<br />
    &lt;Fruits4&gt;Melon&lt;/Fruits4&gt;<br />
  &lt;/Fruits&gt;<br />
&lt;/SampleXML&gt;</p>
<p>Thank you, very much.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: João Luiz</title>
		<link>http://blog.sqlauthority.com/2009/02/12/sql-server-simple-example-of-creating-xml-file-using-t-sql/#comment-340628</link>
		<dc:creator><![CDATA[João Luiz]]></dc:creator>
		<pubDate>Mon, 03 Sep 2012 22:38:05 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=2464#comment-340628</guid>
		<description><![CDATA[Hi, Dave.

I have a requirement such that there should be no self closing tags in an XML result I have to serve to another system.

If, for example, I do a query like this:...

SELECT &#039;Fuit Shop&#039; AS ShopName
       ,&#039;&#039;                       AS Nada
       ,(SELECT &#039;Apple&#039; AS Fruits1
                ,&#039;Pineapple&#039; AS Fruits2
                ,&#039;&#039;                 AS Fruits3
                ,&#039;Melon&#039;       AS Fruits4
         FOR XML PATH(&#039;Fruits&#039;), TYPE)
FOR XML PATH(&#039;&#039;), ROOT(&#039;SampleXML&#039;)

... the result will be:


  Fuit Shop
  
  
    Apple
    Pineapple
    
    Melon
  


Note that while element Nada has a separate closing tag, Fuit3 is self-closing.

How could I modify that query to meet my requirement and get a result as follows?:


  Fuit Shop
  
  
    Apple
    Pineapple
    
    Melon
  


Thank you, very much.]]></description>
		<content:encoded><![CDATA[<p>Hi, Dave.</p>
<p>I have a requirement such that there should be no self closing tags in an XML result I have to serve to another system.</p>
<p>If, for example, I do a query like this:&#8230;</p>
<p>SELECT &#8216;Fuit Shop&#8217; AS ShopName<br />
       ,&#8221;                       AS Nada<br />
       ,(SELECT &#8216;Apple&#8217; AS Fruits1<br />
                ,&#8217;Pineapple&#8217; AS Fruits2<br />
                ,&#8221;                 AS Fruits3<br />
                ,&#8217;Melon&#8217;       AS Fruits4<br />
         FOR XML PATH(&#8216;Fruits&#8217;), TYPE)<br />
FOR XML PATH(&#8221;), ROOT(&#8216;SampleXML&#8217;)</p>
<p>&#8230; the result will be:</p>
<p>  Fuit Shop</p>
<p>    Apple<br />
    Pineapple</p>
<p>    Melon</p>
<p>Note that while element Nada has a separate closing tag, Fuit3 is self-closing.</p>
<p>How could I modify that query to meet my requirement and get a result as follows?:</p>
<p>  Fuit Shop</p>
<p>    Apple<br />
    Pineapple</p>
<p>    Melon</p>
<p>Thank you, very much.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Manbahadur L</title>
		<link>http://blog.sqlauthority.com/2009/02/12/sql-server-simple-example-of-creating-xml-file-using-t-sql/#comment-334700</link>
		<dc:creator><![CDATA[Manbahadur L]]></dc:creator>
		<pubDate>Tue, 21 Aug 2012 06:29:52 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=2464#comment-334700</guid>
		<description><![CDATA[Hi Pinal Dave,
I have tried  XML PATH functionality for convert my query output to xml data convertion. its working fine. I can able to create a xml files for my data. But i need one favor from you. if i open the xml file in notepad or some other editers, the data is coming in paragraph format. i need correct xml format. 

if i open the xml file its showing correct format. 

example:

my data is 

Name       Age      Sex
Mano       29         M
Raji          23         F 

after i convert my data to xml, it is coming like this

 Mano   29   M  and so on..

but i need 

 Mano 
 29 
 M 
and 
so 
on...

like this.

is it possible?  if you give solution it will be a great help to me. 

thanks in advance.

Mano]]></description>
		<content:encoded><![CDATA[<p>Hi Pinal Dave,<br />
I have tried  XML PATH functionality for convert my query output to xml data convertion. its working fine. I can able to create a xml files for my data. But i need one favor from you. if i open the xml file in notepad or some other editers, the data is coming in paragraph format. i need correct xml format. </p>
<p>if i open the xml file its showing correct format. </p>
<p>example:</p>
<p>my data is </p>
<p>Name       Age      Sex<br />
Mano       29         M<br />
Raji          23         F </p>
<p>after i convert my data to xml, it is coming like this</p>
<p> Mano   29   M  and so on..</p>
<p>but i need </p>
<p> Mano<br />
 29<br />
 M<br />
and<br />
so<br />
on&#8230;</p>
<p>like this.</p>
<p>is it possible?  if you give solution it will be a great help to me. </p>
<p>thanks in advance.</p>
<p>Mano</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: K. Wallutt</title>
		<link>http://blog.sqlauthority.com/2009/02/12/sql-server-simple-example-of-creating-xml-file-using-t-sql/#comment-306985</link>
		<dc:creator><![CDATA[K. Wallutt]]></dc:creator>
		<pubDate>Thu, 28 Jun 2012 13:45:40 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=2464#comment-306985</guid>
		<description><![CDATA[Great - helped me a lot - thanks]]></description>
		<content:encoded><![CDATA[<p>Great &#8211; helped me a lot &#8211; thanks</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: aryan</title>
		<link>http://blog.sqlauthority.com/2009/02/12/sql-server-simple-example-of-creating-xml-file-using-t-sql/#comment-306553</link>
		<dc:creator><![CDATA[aryan]]></dc:creator>
		<pubDate>Wed, 27 Jun 2012 16:12:55 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=2464#comment-306553</guid>
		<description><![CDATA[Hey friends, this query is really appreciative once and its working fine but for example if a table consists of 30,000 records then this  &quot; select * from test1 for Xml AUTO,elements,root(‘Sample’) &quot; query converts them ? please immediately respond]]></description>
		<content:encoded><![CDATA[<p>Hey friends, this query is really appreciative once and its working fine but for example if a table consists of 30,000 records then this  &#8221; select * from test1 for Xml AUTO,elements,root(‘Sample’) &#8221; query converts them ? please immediately respond</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: M</title>
		<link>http://blog.sqlauthority.com/2009/02/12/sql-server-simple-example-of-creating-xml-file-using-t-sql/#comment-300823</link>
		<dc:creator><![CDATA[M]]></dc:creator>
		<pubDate>Wed, 13 Jun 2012 13:00:45 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=2464#comment-300823</guid>
		<description><![CDATA[hi

this helped me achieve the following out put


  
    ABBEY WAY
    WILLESBOROUGH
    FRIDAY
  
  
    ABBOTT WAY
    TENTERDEN
    TUESDAY
  


SQL QUERY used

select X.id as &#039;@id&#039;
,	 	X.Street AS &#039;street&#039;
		, X.district as &#039;district&#039;
		, X.collectionday as &#039;collectionday&#039;

FROM [ABC-Collections].[dbo].[IMPORT_XML] X
for XML PATH(&#039;location&#039;), root(&#039;addresses&#039;)

Hope that helps someone]]></description>
		<content:encoded><![CDATA[<p>hi</p>
<p>this helped me achieve the following out put</p>
<p>    ABBEY WAY<br />
    WILLESBOROUGH<br />
    FRIDAY</p>
<p>    ABBOTT WAY<br />
    TENTERDEN<br />
    TUESDAY</p>
<p>SQL QUERY used</p>
<p>select X.id as &#8216;@id&#8217;<br />
,	 	X.Street AS &#8216;street&#8217;<br />
		, X.district as &#8216;district&#8217;<br />
		, X.collectionday as &#8216;collectionday&#8217;</p>
<p>FROM [ABC-Collections].[dbo].[IMPORT_XML] X<br />
for XML PATH(&#8216;location&#8217;), root(&#8216;addresses&#8217;)</p>
<p>Hope that helps someone</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: madhivanan</title>
		<link>http://blog.sqlauthority.com/2009/02/12/sql-server-simple-example-of-creating-xml-file-using-t-sql/#comment-287552</link>
		<dc:creator><![CDATA[madhivanan]]></dc:creator>
		<pubDate>Wed, 23 May 2012 10:56:39 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=2464#comment-287552</guid>
		<description><![CDATA[select value,min(val) as val from table
group by value]]></description>
		<content:encoded><![CDATA[<p>select value,min(val) as val from table<br />
group by value</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bikram Kumar Sahoo</title>
		<link>http://blog.sqlauthority.com/2009/02/12/sql-server-simple-example-of-creating-xml-file-using-t-sql/#comment-285011</link>
		<dc:creator><![CDATA[Bikram Kumar Sahoo]]></dc:creator>
		<pubDate>Wed, 16 May 2012 05:33:15 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=2464#comment-285011</guid>
		<description><![CDATA[hii,
i have one table where the datas are
id value
1 50
2 60
and another table having datas like
value val
50      20
50      30
60      100
60       120
But i want the result like
50 20
60 100

plz help me]]></description>
		<content:encoded><![CDATA[<p>hii,<br />
i have one table where the datas are<br />
id value<br />
1 50<br />
2 60<br />
and another table having datas like<br />
value val<br />
50      20<br />
50      30<br />
60      100<br />
60       120<br />
But i want the result like<br />
50 20<br />
60 100</p>
<p>plz help me</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Pat</title>
		<link>http://blog.sqlauthority.com/2009/02/12/sql-server-simple-example-of-creating-xml-file-using-t-sql/#comment-281162</link>
		<dc:creator><![CDATA[Pat]]></dc:creator>
		<pubDate>Tue, 01 May 2012 15:09:18 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=2464#comment-281162</guid>
		<description><![CDATA[I think this gives a better example of depth.
SELECT ( SELECT &#039;White&#039; AS Color1,
 (select &#039;dark&#039; as shade1,&#039;Light&#039; as shade2 for XML path (&#039;Blue&#039;),TYPE ), 
 &#039;Blue&#039; AS Color2,
 &#039;Black&#039; AS Color3,
 &#039;Light&#039; AS &#039;Color4/@Special&#039;,
 &#039;Green&#039; AS Color4,
 &#039;Red&#039; AS Color5
 FOR
 XML PATH(&#039;Colors&#039;),
 TYPE
 ),
 ( SELECT &#039;Apple&#039; AS Fruits1,
 &#039;Pineapple&#039; AS Fruits2,
 &#039;Grapes&#039; AS Fruits3,
 &#039;Melon&#039; AS Fruits4
 FOR
 XML PATH(&#039;Fruits&#039;),
 TYPE
 )
 FOR XML PATH(&#039;&#039;),
 ROOT(&#039;SampleXML&#039;)
 GO]]></description>
		<content:encoded><![CDATA[<p>I think this gives a better example of depth.<br />
SELECT ( SELECT &#8216;White&#8217; AS Color1,<br />
 (select &#8216;dark&#8217; as shade1,&#8217;Light&#8217; as shade2 for XML path (&#8216;Blue&#8217;),TYPE ),<br />
 &#8216;Blue&#8217; AS Color2,<br />
 &#8216;Black&#8217; AS Color3,<br />
 &#8216;Light&#8217; AS &#8216;Color4/@Special&#8217;,<br />
 &#8216;Green&#8217; AS Color4,<br />
 &#8216;Red&#8217; AS Color5<br />
 FOR<br />
 XML PATH(&#8216;Colors&#8217;),<br />
 TYPE<br />
 ),<br />
 ( SELECT &#8216;Apple&#8217; AS Fruits1,<br />
 &#8216;Pineapple&#8217; AS Fruits2,<br />
 &#8216;Grapes&#8217; AS Fruits3,<br />
 &#8216;Melon&#8217; AS Fruits4<br />
 FOR<br />
 XML PATH(&#8216;Fruits&#8217;),<br />
 TYPE<br />
 )<br />
 FOR XML PATH(&#8221;),<br />
 ROOT(&#8216;SampleXML&#8217;)<br />
 GO</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Joey</title>
		<link>http://blog.sqlauthority.com/2009/02/12/sql-server-simple-example-of-creating-xml-file-using-t-sql/#comment-279394</link>
		<dc:creator><![CDATA[Joey]]></dc:creator>
		<pubDate>Wed, 25 Apr 2012 04:32:46 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=2464#comment-279394</guid>
		<description><![CDATA[Try this:

SELECT(SELECT &#039;White&#039; AS Color FOR XML PATH(&#039;&#039;), TYPE),
(SELECT &#039;Blue&#039; AS Color FOR XML PATH(&#039;&#039;), TYPE),
(SELECT &#039;Black&#039; AS Color FOR XML PATH(&#039;&#039;), TYPE),
(SELECT &#039;Light&#039; AS &#039;Color/@special&#039;, &#039;Green&#039; AS Color FOR XML PATH(&#039;&#039;), TYPE),
(SELECT &#039;Sun&#039; AS &#039;Color/@subtype&#039;, &#039;Red&#039; AS Color FOR XML PATH(&#039;&#039;), TYPE)
FOR XML PATH(&#039;&#039;), ROOT(&#039;Colors&#039;)
GO

--Generated XML:
--
--  White
--  Blue
--  Black
--  Green
--  Red
--]]></description>
		<content:encoded><![CDATA[<p>Try this:</p>
<p>SELECT(SELECT &#8216;White&#8217; AS Color FOR XML PATH(&#8221;), TYPE),<br />
(SELECT &#8216;Blue&#8217; AS Color FOR XML PATH(&#8221;), TYPE),<br />
(SELECT &#8216;Black&#8217; AS Color FOR XML PATH(&#8221;), TYPE),<br />
(SELECT &#8216;Light&#8217; AS &#8216;Color/@special&#8217;, &#8216;Green&#8217; AS Color FOR XML PATH(&#8221;), TYPE),<br />
(SELECT &#8216;Sun&#8217; AS &#8216;Color/@subtype&#8217;, &#8216;Red&#8217; AS Color FOR XML PATH(&#8221;), TYPE)<br />
FOR XML PATH(&#8221;), ROOT(&#8216;Colors&#8217;)<br />
GO</p>
<p>&#8211;Generated XML:<br />
&#8211;<br />
&#8211;  White<br />
&#8211;  Blue<br />
&#8211;  Black<br />
&#8211;  Green<br />
&#8211;  Red<br />
&#8211;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: MaxT</title>
		<link>http://blog.sqlauthority.com/2009/02/12/sql-server-simple-example-of-creating-xml-file-using-t-sql/#comment-275751</link>
		<dc:creator><![CDATA[MaxT]]></dc:creator>
		<pubDate>Fri, 13 Apr 2012 13:27:39 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=2464#comment-275751</guid>
		<description><![CDATA[Will using this method properly encode any XML special characters?]]></description>
		<content:encoded><![CDATA[<p>Will using this method properly encode any XML special characters?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bhagyashree</title>
		<link>http://blog.sqlauthority.com/2009/02/12/sql-server-simple-example-of-creating-xml-file-using-t-sql/#comment-258826</link>
		<dc:creator><![CDATA[Bhagyashree]]></dc:creator>
		<pubDate>Sat, 03 Mar 2012 07:33:47 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=2464#comment-258826</guid>
		<description><![CDATA[Its really helpful. Thank you!!]]></description>
		<content:encoded><![CDATA[<p>Its really helpful. Thank you!!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Neha</title>
		<link>http://blog.sqlauthority.com/2009/02/12/sql-server-simple-example-of-creating-xml-file-using-t-sql/#comment-255362</link>
		<dc:creator><![CDATA[Neha]]></dc:creator>
		<pubDate>Wed, 22 Feb 2012 18:48:14 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=2464#comment-255362</guid>
		<description><![CDATA[Also, I need to mention the database used in SQL 2008.]]></description>
		<content:encoded><![CDATA[<p>Also, I need to mention the database used in SQL 2008.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Neha</title>
		<link>http://blog.sqlauthority.com/2009/02/12/sql-server-simple-example-of-creating-xml-file-using-t-sql/#comment-255361</link>
		<dc:creator><![CDATA[Neha]]></dc:creator>
		<pubDate>Wed, 22 Feb 2012 18:47:08 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=2464#comment-255361</guid>
		<description><![CDATA[Hi, 
I need help on creating a stored procedure which can fetch the data from database and write the output to an xml file. 

Kindly help. Thanks in advance!]]></description>
		<content:encoded><![CDATA[<p>Hi,<br />
I need help on creating a stored procedure which can fetch the data from database and write the output to an xml file. </p>
<p>Kindly help. Thanks in advance!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: sanjay</title>
		<link>http://blog.sqlauthority.com/2009/02/12/sql-server-simple-example-of-creating-xml-file-using-t-sql/#comment-254524</link>
		<dc:creator><![CDATA[sanjay]]></dc:creator>
		<pubDate>Mon, 20 Feb 2012 16:31:20 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=2464#comment-254524</guid>
		<description><![CDATA[Hello Pinal ,

I am using BCP command to create xml file on remote server.
on remote server xml is created successfully, but subnodes are getting brakes. please provide me soluation to resolve subnode brake problam.

Thanks
Sanjay]]></description>
		<content:encoded><![CDATA[<p>Hello Pinal ,</p>
<p>I am using BCP command to create xml file on remote server.<br />
on remote server xml is created successfully, but subnodes are getting brakes. please provide me soluation to resolve subnode brake problam.</p>
<p>Thanks<br />
Sanjay</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: SQL SERVER &#8211; Methods for Accessing SQL Server XML Datatype &#8211; Quiz &#8211; Puzzle &#8211; 20 of 31 &#171; SQL Server Journey with SQL Authority</title>
		<link>http://blog.sqlauthority.com/2009/02/12/sql-server-simple-example-of-creating-xml-file-using-t-sql/#comment-241555</link>
		<dc:creator><![CDATA[SQL SERVER &#8211; Methods for Accessing SQL Server XML Datatype &#8211; Quiz &#8211; Puzzle &#8211; 20 of 31 &#171; SQL Server Journey with SQL Authority]]></dc:creator>
		<pubDate>Sat, 21 Jan 2012 01:31:47 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=2464#comment-241555</guid>
		<description><![CDATA[[...] SQL Server Interview Questions and Answers ISBN: 1466405643 Page#137-139 SELECT * FROM XML Shredding XML Validate an XML document in TSQL using XSD Simple Example of Reading XML File Using T-SQL Simple Example of Creating XML File Using T-SQL [...]]]></description>
		<content:encoded><![CDATA[<p>[...] SQL Server Interview Questions and Answers ISBN: 1466405643 Page#137-139 SELECT * FROM XML Shredding XML Validate an XML document in TSQL using XSD Simple Example of Reading XML File Using T-SQL Simple Example of Creating XML File Using T-SQL [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: henrry</title>
		<link>http://blog.sqlauthority.com/2009/02/12/sql-server-simple-example-of-creating-xml-file-using-t-sql/#comment-204371</link>
		<dc:creator><![CDATA[henrry]]></dc:creator>
		<pubDate>Fri, 25 Nov 2011 14:34:32 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=2464#comment-204371</guid>
		<description><![CDATA[Hi

    how i can  insert in the  xml result on the top from a sql server 2008 query this ?

thanks]]></description>
		<content:encoded><![CDATA[<p>Hi</p>
<p>    how i can  insert in the  xml result on the top from a sql server 2008 query this ?</p>
<p>thanks</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sat</title>
		<link>http://blog.sqlauthority.com/2009/02/12/sql-server-simple-example-of-creating-xml-file-using-t-sql/#comment-183636</link>
		<dc:creator><![CDATA[Sat]]></dc:creator>
		<pubDate>Wed, 26 Oct 2011 08:25:26 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=2464#comment-183636</guid>
		<description><![CDATA[Pinal Bhai You are the Best.

Sat]]></description>
		<content:encoded><![CDATA[<p>Pinal Bhai You are the Best.</p>
<p>Sat</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mariselvam</title>
		<link>http://blog.sqlauthority.com/2009/02/12/sql-server-simple-example-of-creating-xml-file-using-t-sql/#comment-175090</link>
		<dc:creator><![CDATA[Mariselvam]]></dc:creator>
		<pubDate>Tue, 04 Oct 2011 16:22:52 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=2464#comment-175090</guid>
		<description><![CDATA[HI Pinal,

I want to create a XML of this type.




   
   




Tags Email1,Email2 are dynamic. Also, NumberOfLeads will change for each listing.

Can you help with this one?

Thanks!
Mari]]></description>
		<content:encoded><![CDATA[<p>HI Pinal,</p>
<p>I want to create a XML of this type.</p>
<p>Tags Email1,Email2 are dynamic. Also, NumberOfLeads will change for each listing.</p>
<p>Can you help with this one?</p>
<p>Thanks!<br />
Mari</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sridhar</title>
		<link>http://blog.sqlauthority.com/2009/02/12/sql-server-simple-example-of-creating-xml-file-using-t-sql/#comment-171571</link>
		<dc:creator><![CDATA[Sridhar]]></dc:creator>
		<pubDate>Sun, 25 Sep 2011 08:23:58 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=2464#comment-171571</guid>
		<description><![CDATA[Hi All,

I want to write the below code without using the Xml path, type or root. i.e. want to rewrite code using pure sql statements using xml functionalities. Will inserting just UNION ALL and removing XML path, type and root work for me. 
Thanks in advance

SELECT ( SELECT &#039;White&#039; AS Color1,
&#039;Blue&#039; AS Color2,
&#039;Black&#039; AS Color3,
&#039;Light&#039; AS &#039;Color4/@Special&#039;,
&#039;Green&#039; AS Color4,
&#039;Red&#039; AS Color5
FOR
XML PATH(&#039;Colors&#039;),
TYPE
),
( SELECT &#039;Apple&#039; AS Fruits1,
&#039;Pineapple&#039; AS Fruits2,
&#039;Grapes&#039; AS Fruits3,
&#039;Melon&#039; AS Fruits4
FOR
XML PATH(&#039;Fruits&#039;),
TYPE
)
FOR XML PATH(&#039;&#039;),
ROOT(&#039;SampleXML&#039;)
GO]]></description>
		<content:encoded><![CDATA[<p>Hi All,</p>
<p>I want to write the below code without using the Xml path, type or root. i.e. want to rewrite code using pure sql statements using xml functionalities. Will inserting just UNION ALL and removing XML path, type and root work for me.<br />
Thanks in advance</p>
<p>SELECT ( SELECT &#8216;White&#8217; AS Color1,<br />
&#8216;Blue&#8217; AS Color2,<br />
&#8216;Black&#8217; AS Color3,<br />
&#8216;Light&#8217; AS &#8216;Color4/@Special&#8217;,<br />
&#8216;Green&#8217; AS Color4,<br />
&#8216;Red&#8217; AS Color5<br />
FOR<br />
XML PATH(&#8216;Colors&#8217;),<br />
TYPE<br />
),<br />
( SELECT &#8216;Apple&#8217; AS Fruits1,<br />
&#8216;Pineapple&#8217; AS Fruits2,<br />
&#8216;Grapes&#8217; AS Fruits3,<br />
&#8216;Melon&#8217; AS Fruits4<br />
FOR<br />
XML PATH(&#8216;Fruits&#8217;),<br />
TYPE<br />
)<br />
FOR XML PATH(&#8221;),<br />
ROOT(&#8216;SampleXML&#8217;)<br />
GO</p>
]]></content:encoded>
	</item>
</channel>
</rss>
