0

I have a template of an Excel XML document. Is there anyway I can build the XML document is SQL and have SQL Server return the XML document to me via stored proc.?

I am trying to see if SQL Server can not just return the data for the spreadsheet but the actual Excel XML document with the data in it.

Something similar to this.

http://msdn.microsoft.com/en-us/library/office/aa191724%28v=office.11%29.aspx

I want to build the XML is SQL.

Kyle Johnson
  • 763
  • 1
  • 13
  • 31

1 Answers1

0

Yes, you can use the FOR XML clause.

select * from table for xml raw

You can also use XML AUTO or XML EXPLICIT

Bill Gregg
  • 7,067
  • 2
  • 22
  • 39
  • 1
    Or in SQL Server 2008, you can also use `FOR XML PATH` which is often much easier to use but just as powerful and flexible as the explicit stuff – marc_s Jun 04 '13 at 20:34