Thursday, December 13, 2012

Converting SQL Server Database to XML format

i. First Open Notepad and write below code till </root>:


Now Save it as c:\sqlexamples\template.tpl

Next you open SQL Server Query Editor and type:

sp_makewebtask @outputfile = 'c:\myxmlfile.xml',
    @query = 'select * from sysobjects for xml auto',
    @templatefile = 'c:\sqlexamples\template.tpl'

The Result is a XML-File!

Happy Coding! ;)

No comments:

Post a Comment