Use the Following Stored Procedure
CREATE PROC EXPORT_TO_XML
(
@TABLENAME VARCHAR(60),
@XML XML output
)
AS
set @XML = (SELECT *
FROM @TABLENAME
FOR
XML PATH(''), TYPE, ELEMENTS
)
This Sp will accept the name of the table and return a XML String and the Following code tells you where to save it in your local disk.
using System;
using System.Xml;
public class Sample {
public static void Main() {
// Create the XmlDocument.
XmlDocument doc = new XmlDocument();
doc.LoadXml("<item><name>wrench</name></item>");
// Add a price element.
XmlElement newElem = doc.CreateElement("price");
newElem.InnerText = "10.95";
doc.DocumentElement.AppendChild(newElem);
// Save the document to a file. White space is
// preserved (no white space).
doc.PreserveWhitespace = true;
doc.Save("data.xml");
}
}
Thank you for Posting in .NEt Funda
Thank you for posting at Dotnetfunda
[Administrator]
Srivalli, if this helps please login to Mark As Answer. | Alert Moderator