Retrieveing DB Values in XML Format using XML RAW

As we discussed about XML Auto in my previous post, here is another option called XML RAW


This sends each row of data in your result set back as a single data element, with the element name of "row" and with each column listed as an attribute of the "row" element. Even if you join multiple tables, RAW outputs the results with the same number of elements as in SQL Query

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 RAW


<row Customerid="ALFKI" Companyname="Alfreds Futterkiste" Orderid="10643" Orderdate="1997-08-25T00:00:00"/><row Customerid="ALFKI" Companyname="Alfreds Futterkiste" Orderid="10692" Orderdate="1997-10-03T00:00:00"/><row Customerid="ALFKI" Companyname="Alfre


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: