Following code will create xml file from sql server table.
SQL Server Table
XML Output
<myroot>
<blogs>>/blogs>
<blogid>2601</blogid>
<title>Program to illustrate operator overloading from string</title>
<contentvalue>blah blah blah</contentvalue>
<creationdate>2013-02-18 13:57:00</creationdate>
....
....
....
....
....
</myroot>
Script to convert sql server table to xml file
declare @XmlOutput xml
set @XmlOutput =
(select BlogId, Title, ContentValue, CreationDate from Blogs
FOR XML AUTO, ROOT('MyRoot'), ELEMENTS)
select @XmlOutput
No comments:
Post a Comment