x

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?

more ▼

asked Oct 12, 2009 at 01:02 PM in Default

Melvyn Harbour 1 gravatar image

Melvyn Harbour 1 ♦♦
1.4k 18 20 22

(comments are locked)
10|1200 characters needed characters left

1 answer: sort voted first

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.

more ▼

answered Oct 13, 2009 at 10:34 AM

Grant Fritchey gravatar image

Grant Fritchey ♦♦
98.9k 19 21 74

(comments are locked)
10|1200 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

New code box

There's a new way to format code on the site - the red speech bubble logo will automatically format T-SQL for you. The original code box is still there for XML, etc. More details here.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

SQL Server Central

Need long-form SQL discussion? SQLserverCentral.com is the place.

Topics:

x1834
x4

asked: Oct 12, 2009 at 01:02 PM

Seen: 2300 times

Last Updated: Oct 15, 2009 at 05:56 AM