August 5, 2010 at 2:37 am
Hi
Here I have a Table such as the following :
IDintPrimary Key
TitlenVarchar(500)
Parent_IDint
There is a one to many relation-ship between Parent_ID and ID.
The problem is that i need sqlServer to generate an xml as follows :
<Items>
<Item Title="One" >
<Item Title="OneOne" >
<Item Title="OneOneOne"
</Item>
<Item Title="OneTwo" />
</Item>
<Item Title="Two" />
<Item Title="Three" />
<Item Title="Four" >
<Item Title="FourOne" />
<Item Title="FourTwo" >
<Item Title="FourTwoOne" />
<Item Title="FourTwoTwo" />
<Item Title="FourTwoThree" >
<Item Title="FourTwoThreeOne" />
<Item Title="FourTwoThreeTwo" />
</Item>
</Item>
</Item>
</Items>
As you might have been understood, there might be multiple inner joins within one table per record.
I worked out a bad way out for it which I'm sure is the most horrendous. So that, I'm thinking of the best possible solution, t-sql might offer.
Thanks for your upcoming answers
Kind Regards
August 5, 2010 at 8:17 am
You know, the people that help out here are all un-paid volunteers. Providing the DDL scripts (CREATE TABLE, CREATE INDEX, etc.) for the tables affected, and INSERT statements to put some test data into those tables that shows your problem will go a long way in getting people to look at your issue and help you out. Please include code for what you have already tried. Don't forget to include what your expected results should be, based on the sample data provided. As a bonus to you, you will get tested code back. For more details on how to get all of this into your post, please look at the first link in my signature.
Notice how nobody has responded? That's why - you haven't made it easy for us to help you, so we just pass on it.
Wayne
Microsoft Certified Master: SQL Server 2008
Author - SQL Server T-SQL Recipes
August 5, 2010 at 11:18 am
I guess I found what I need.
Thank you.
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply