I need to write a Stored procedure in SQL server whose data returned will be used to generate a XML file.
My XML file to be in structure of
<root>
<ANode></ANode>
<BNode></BNode>
<CNode>
<C1Node>
<C11Node></C11Node>
<C12Node></C12Node>
</C1Node>
<C2Node>
<C21Node></C21Node>
<C22Node></C22Node>
</C2Node>
<C3Node>
<C31Node></C31Node>
<C32Node></C32Node>
</C3Node>
</CNode>
</root>
My question is, in the stored procedure we can select values for ANode and BNode as a simple SELECT statement like
Select ANodeVal,BNodeVal from Table
But how to design the stored procedure to get records for the CNode which is a subtree which has 3 or more(dynamic) separate nodes in it for each record in addition to the normal ANode and BNode
Please help me in this desperate problem.