Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Expand this to multiple concurrent hierarchies and effective date sensitive? Expand / Collapse
Author
Message
Posted Thursday, March 10, 2011 9:12 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Thursday, April 17, 2014 8:24 AM
Points: 1, Visits: 26
How can I apply this model with a couple of extended properties.

Using an employee/manager model, I have added a 'hierarchy code' to both entities and an effective date. How could I incorporate these two additional properties to the process in this discussion?
Post #1076333
Posted Thursday, March 10, 2011 9:22 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Friday, June 27, 2014 12:43 PM
Points: 13,872, Visits: 9,596
Turn the adjacency hierarchy into a standard many-to-many (joining the primary table back to itself), with a date-effective range in the join table.

When you build the CTE, you just have to include both tables, and then it works just like any other adjacency hierarchy.

The biggest issue with this is that it becomes possible to have the same node at multiple levels of the hierarchy, which isn't possible in a single-table version. You thus have to use moderately complex code to make sure that inserts and updates don't allow that, or you end up with infinite recursion problems.


- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
Property of The Thread

"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon
Post #1076344
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse