Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
HierarchyID - to use it or not?
Message
De
08/02/2010 12:45:03
 
 
À
Tous
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Conception bases de données
Titre:
HierarchyID - to use it or not?
Versions des environnements
SQL Server:
SQL Server 2008
Divers
Thread ID:
01448131
Message ID:
01448131
Vues:
153
I need to model an Agent structure where an Agent reports to a superior who can report to a superior and so on ad infinitum.

I have recently discovered the HierarchyID type in SQL Server and would like to know how exactly I need to create the table.

I have an AgentPK field of type uniqueidentifier. Now I need the Hierarchy, do I just create a field like HieararchyPath type HierarchyID? I get the impression from what I have found on-line that the hierarchyid field holds the path of all superiors' primary keys, so is a uniqueidentifier appropriate to use as the table's Primary Key? Or does it not matter?

Is using the hierarchyid the best way to do this, or do I go with the old ReportsTo field where I store the superior's Primary Key in this field?
Frank.

Frank Cazabon
Samaan Systems Ltd.
www.samaansystems.com
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform