sureshk 23318 (10/16/2012)
i have a table like
TID PID DSC
1 0 Parent1
2 1 Child1
3 1 Child2
4 1 Child3
5 0 ParentA
6 5 ChildA
7 5 ChildB
That's what's known as an "Adjacency List". They usually hold a hierarchical tree of data. An "Adjacency List" is very easy for even humans to maintain but are seriously performance challenged when it comes to processing. If it were me, I'd build a Nested Sets structure into this table for the best of both worlds.
It would appear that you're either missing the very top level or you don't mind working with multiple trees known as a "forest". The problem with the missing the top level is that you can't actually have any DRI between the PID and the TID column.
I also agree with the previous post... what is the actual querstion here?
is pronounced ree-bar and is a Modenism for R
First step towards the paradigm shift of writing Set Based code: Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column.
Although they tell us that they want it real bad, our primary goal is to ensure that we dont actually give it to them that way.
Although change is inevitable, change for the better is usually not.
Just because you can do something in PowerShell, doesnt mean you should. Helpful Links:
How to post code problemsHow to post performance problemsForum FAQs