SQL Tips by Namwar Rizvi

August 28, 2007

Represent Trees and Graphs in TSQL by using new data type: HierarchyID

Filed under: Information,New Features,SQL Server 2008,TSQL — namwar @ 8:03 PM

Everyone is talking about SQL Server 2008 these days because it is coming up with lots of enhancements in nearly every area. One of these enhancements is the introduction of a new data type called HierarchyID.
This data type is introduced to address one of the typical problem faced by nearly every medium to large size enterprises which is the representation of Trees and Graphs in RDBMS. Trees and Graph concepts are applicable to various real life problems like Bill Of Materials (BOM) , Organizational Hierarchy, Road Networks etc.

SQL Server 2008 provides you full solution by giving you HierarchyID data type and its relevant functions to play with it. Following is the list of function available to manipulate Hierarchical data with HierarchyID data type:

1) GetAncestor
2) GetDescendant
3) GetLevel
4) GetRoot
5) IsDescendant
6) Parse
7) Read
8) Reparent
9) ToString
10) Write

For detailed discussion of these functions please visit here

Advertisements

Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Blog at WordPress.com.

%d bloggers like this: