question

Melvyn Harbour 1 avatar image
Melvyn Harbour 1 asked

Benefits of using HierarchyID

What are the benefits of using the built in HierarchyID data type rather than rolling my own and writing appropriate stored procedures to do my data access?

sql-server-2008hierarchyid
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
Grant Fritchey avatar image
Grant Fritchey answered

Short answer, it's easier to write code against it. If you roll your own storage mechanism, and write all your own access code, you'll do fine, but what happens when the next person has to write code against that same set of columns. They'll have to find out through some method of documentation what you did, how you did it, why you did it and how to access it themselves. With a HierarchyID column, the documentation is built into the product. Everyone is going to access it in the same way, every time. That consistency will lead to better code, easier to maintain and easier to hand off to others.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.