Geeks With Blogs
Catherine Russell Architect, President of "Women In Information Technology" Group

Managing a Tree Using hierarchyid

Although a hierarchyid column does not necessarily represent a tree, an application can easily ensure that it does.
When generating new values, do one of the following:
Keep track of the last child number in the parent row.
Compute the last child. Doing this efficiently requires a breadth-first index.
Enforce uniqueness by creating a unique index on the column, perhaps as part of a clustering key. To ensure unique values are inserted, do one of the following:
Determining the uniqueness of each new child node and insert it, in a serializable transaction.
Detect unique key violation failures and retry.

To read more, go to
This topic includes information about common activities in managing and querying a hierarchical data tree.

Posted on Wednesday, September 22, 2010 1:41 PM Tutorials , ASP.NET | Back to top

Comments on this post: Working with hierarchyid Data in SQL Server 2008 R2

No comments posted yet.
Your comment:
 (will show your gravatar)

Copyright © CatherineRussell | Powered by: