locked
How to load data from datatable to xml message ? RRS feed

  • Question

  • Can any one let me know how can i populate datatable value to xml.

    In my current scenario i am reading data from Teradata database and need to populate corresponding xml message. 

    Can anyone let me know the possible ways to do this operation.

    Wednesday, March 25, 2015 10:15 PM

Answers

All replies

  • Hi Phill Ed,

    With your scenario, you can create a store procedure that read data from Teradata database and return the xml message result.

    you can refer to this link https://www.simple-talk.com/sql/learn-sql-server/using-the-for-xml-clause-to-return-query-results-as-xml/

    hope this useful for you!

    Thursday, March 26, 2015 1:52 AM
  • If you want to convert Dataset to XML outside the BizTalk there are multiple ways like using Stored Proc as suggested by Daniel.

    http://www.codeproject.com/Articles/54584/Controlling-the-XML-output-when-using-the-FOR-XML

    If you want to perform this conversion within pipeline comp or Orchestration you can use C#

    http://csharp.net-informations.com/xml/create-xml-from%20dataset.htm


    Thanks,
    Prashant
    ----------------------------------------
    Please mark this post accordingly if it answers your query or is helpful.

    • Marked as answer by Angie Xu Thursday, April 2, 2015 5:32 AM
    Thursday, March 26, 2015 6:23 AM
  • In sql we have xml auto xml data. But not sure about Teradata. If it is not possible to get xml data from Teradata query, than you could use below code to load ur xml from data set and perform operation.

    DataSet dataSet = new DataSet(); // Add code here to populate the DataSet with schema, but not data. XmlDataDocument xmlDoc = new XmlDataDocument(dataSet);

    Xmldocument var = new xmldocument();

    var.loadxml(xmlDoc.innerXml)

    This will solve your problem.

    Friday, March 27, 2015 2:43 AM