I have a stored procedure th开发者_如何学JAVAat returns a single recordset. is it possible to convert it into xml like below
<employee>
<firstname>x</name>
<lastname>x</name>
<dob>x</dob>
</employee>
using some simple options in sql 2000?
SELECT *
FROM MyTable
WHERE 1 = 1
FOR XML AUTO
Instead of the AUTO, you can use RAW, EXPLICIT or PATH (see here http://msdn.microsoft.com/en-us/library/ms178107(v=SQL.90).aspx), but AUTO generally does what you want.
I can only find notes on MSDN for SQL 2008 and 2005 but I'm sure I've used this on 2000 before...
Thanks Skrealin
the query below works
select * from Mytable employee for xml auto , elements
精彩评论