Retrieveing DB Values in XML Format using XML AUTO

XML AUTO:


The main aim is to the Output data from the sql query will be in the XML Format.
XML AUTO option labels each element with either the table name that the data source is from. If there is data output from more than one table, then the data from each table is split into seperate, nested elements.


use northwind

select Customers.Customerid, Customers.Companyname, Orders.Orderid, Orders.Orderdate
from Customers
join Orders
on Customers.Customerid = Orders.Customerid
where Customers.Customerid ='ALFKI'
for xml auto


Output:




<Customers Customerid="ALFKI" Companyname="Alfreds Futterkiste"><Orders Orderid="10643" Orderdate="1997-08-25T00:00:00"/><Orders Orderid="10692" Orderdate="1997-10-03T00:00:00"/><Orders Orderid="10702" Orderdate="1997-10-13T00:00:00"/><Orders Orderid="1083


Comments

No responses found. Be the first to comment...


  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:
    Email: