Posted 1/2/2010 4:19:51 AM
|
|
|
|
How to create auto number in xml database?
Sandeep
9220394648
http://www.technowizpvtltd.com
|
|
Posted 1/15/2010 6:44:13 AM
|
|
|
|
This article describes how to generate XML string from relational database tables.
http://www.dotnetfunda.com/articles/article119.aspx
|
|
Posted 2/19/2010 3:21:15 AM
|
|
|
|
Now, lets see how XML can directly be produced from SQL Server instead of the usual approach of serializing the entity classes in .Net. The benefits out of this will be:
1.
Eliminate N number of round trips to the Database Server.
2.
The cost involved in serializing the entity classes.
3.
Ability to modify just the routine if at all any modifications are desired.
This article aims at explaining how can one generate XML out to SQL Server. Now, once the XML is out if the technology is either .NET or any other technology the same can be consumed with ease.
Wasting no more time, lets get into how this can be achieved.
Code
#1. Generates specific columns from the orders and ordersplits table.
Select (Select Orders.OrderId, OrderSplits.OrderSplitId, OrderSplits.SplitNumber from Orders Inner Join OrderSplits on Orders.OrderId = OrderSplits.OrderId where OrderSplits.OrderSplitId=11111 Order By Orders.OrderId, OrderSplits.SplitNumber FOR XML AUTO, ELEMENTS XSINIL)
#2. Generates all columns in the output from the orders and ordersplits tables.
Select (Select Orders.*, OrderSplits.* from Orders Inner Join OrderSplits on Orders.OrderId = OrderSplits.OrderId where OrderSplits.OrderSplitId=11111 Order By Orders.OrderId, OrderSplits.SplitNumber FOR XML AUTO, ELEMENTS XSINIL)
|
|
|
|