Thursday, October 30, 2014

Get output in XML format from sqlserver.

To get an output in XML format from sqlserver , do following steps.
declare @XmlOutput xml
set @XmlOutput = (select top 10 * from table_Name where id=235
FOR XML AUTO, ROOT('Flex'), ELEMENTS)

select @XmlOutput --In place of this if we write the file location then output will be written over there.