October 13, 2004 at 11:28 am
Comments posted to this topic are about the content posted at http://www.sqlservercentral.com/columnists/WFillis
November 10, 2004 at 7:23 am
There are indeed many solutions to creating XML from SQL Server. I have had good success for several years using stored procedures that return multiple recordsets with embedded instructions for converting them to XML. The only non-SQL code required is a generic utility class that executes the stored procedures, then interprets and converts the results. For example:
create procedure shpClientOrders( @clientID int ) as
select 'DATASET clients.client' AS _shapeInfo
select * from clients where id=@clientID
select 'DATASET orders.order RELATE TO clients' as _shapeInfo
select * from orders where clientID=@clientID
select 'DATASET orderItems.item RELATE orderID to orders.id GROUPRECORDS' as _shapeInfo
select * from orderItems where clientID=@clientID
results in:
<client id='1234' name='Client Name'...>
<order id='92342' orderDate='2004-10-12'>
<items>
<item id='00093' description='Skippy 12oz.' quantity='3'/>
<item id='00093' description='Welch's 8oz.' quantity='2'/>
</items>
</order>
</client>
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy