<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>H is for… HierarchyID</title><link>http://blogs.msdn.com/b/jimoneil/archive/2009/02/23/h-is-for-hierarchyid.aspx</link><description>hierarchyid is a new system data type in SQL Server 2008 used to represent a position within a hierarchy.&amp;#160; The value of an hierarchyid column is an encoded representation of the path from the root to the given node (row) – kind of like a directory</description><dc:language>en-US</dc:language><generator>Telligent Evolution Platform Developer Build (Build: 5.6.50428.7875)</generator><item><title>re: H is for… HierarchyID</title><link>http://blogs.msdn.com/b/jimoneil/archive/2009/02/23/h-is-for-hierarchyid.aspx#10332625</link><pubDate>Mon, 23 Jul 2012 17:13:04 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10332625</guid><dc:creator>Kevin Russell</dc:creator><description>&lt;p&gt;Why would this ever be needed? &amp;nbsp;Entity Framework does not support it, LINQ2SQL does not support it...I fail to understand why all of these unsupported bells and whistles keep appearing when they are pretty much useless to anyone developing a business application.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10332625" width="1" height="1"&gt;</description></item><item><title>re: H is for… HierarchyID</title><link>http://blogs.msdn.com/b/jimoneil/archive/2009/02/23/h-is-for-hierarchyid.aspx#10086308</link><pubDate>Thu, 04 Nov 2010 20:05:51 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10086308</guid><dc:creator>Jim O'Neil</dc:creator><description>&lt;p&gt;For the post, I &amp;#39;cheated&amp;#39;. &amp;nbsp;I used PowerPoint SmartArt (one of the hierarchy formats) to generate the pictures from the values I entered manually. &amp;nbsp;That said, PowerPoint does have object model you can programmatically access via VSTO (Visual Studio Tools for Office), so there may be a way to generate them.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10086308" width="1" height="1"&gt;</description></item><item><title>re: H is for… HierarchyID</title><link>http://blogs.msdn.com/b/jimoneil/archive/2009/02/23/h-is-for-hierarchyid.aspx#10085822</link><pubDate>Thu, 04 Nov 2010 00:41:26 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10085822</guid><dc:creator>Net Boy</dc:creator><description>&lt;p&gt;Great article!&lt;/p&gt;
&lt;p&gt;Is there a way to generate the nice pictures from your data?&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10085822" width="1" height="1"&gt;</description></item><item><title>re: H is for… HierarchyID</title><link>http://blogs.msdn.com/b/jimoneil/archive/2009/02/23/h-is-for-hierarchyid.aspx#10036530</link><pubDate>Fri, 09 Jul 2010 18:24:52 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10036530</guid><dc:creator>Jim O'Neil</dc:creator><description>&lt;p&gt;Sam, basically select using IsDescendant and see if the count is &amp;gt; 1 (a node is considered to be a descendant of itself). &amp;nbsp;For example, ken0 is the CEO and ben0 is a buyer (leaf node):&lt;/p&gt;
&lt;p&gt;// this returns 290 (not a leaf)&lt;/p&gt;
&lt;p&gt;SELECT COUNT(*) FROM HumanResources.Employee&lt;/p&gt;
&lt;p&gt;WHERE OrganizationNode.IsDescendantOf((SELECT OrganizationNode FROM HumanResources.Employee&lt;/p&gt;
&lt;p&gt; &amp;nbsp;WHERE LoginID = &amp;#39;adventure-works\ken0&amp;#39;)) = 1&lt;/p&gt;
&lt;p&gt;// this returns 1 (leaf node)&lt;/p&gt;
&lt;p&gt;SELECT COUNT(*) FROM HumanResources.Employee&lt;/p&gt;
&lt;p&gt;WHERE OrganizationNode.IsDescendantOf((SELECT OrganizationNode FROM HumanResources.Employee&lt;/p&gt;
&lt;p&gt; &amp;nbsp;WHERE LoginID = &amp;#39;adventure-works\ben0&amp;#39;)) = 1&lt;/p&gt;
&lt;p&gt;HTH, Jim&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10036530" width="1" height="1"&gt;</description></item><item><title>re: H is for… HierarchyID</title><link>http://blogs.msdn.com/b/jimoneil/archive/2009/02/23/h-is-for-hierarchyid.aspx#10035988</link><pubDate>Thu, 08 Jul 2010 16:10:27 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10035988</guid><dc:creator>Sam High</dc:creator><description>&lt;p&gt;How can I tell if a hierarchyid has any descendants (Am I a Leaf or a Node)&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10035988" width="1" height="1"&gt;</description></item><item><title>re: H is for… HierarchyID</title><link>http://blogs.msdn.com/b/jimoneil/archive/2009/02/23/h-is-for-hierarchyid.aspx#9986236</link><pubDate>Sat, 27 Mar 2010 20:49:52 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9986236</guid><dc:creator>Roger Mathews</dc:creator><description>&lt;p&gt;This is a great article. &amp;nbsp;I am very excited with this new feature of SQL as it has tremendous potential, especially in our environment.&lt;/p&gt;
&lt;p&gt;Cheers!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9986236" width="1" height="1"&gt;</description></item><item><title>re: H is for… HierarchyID</title><link>http://blogs.msdn.com/b/jimoneil/archive/2009/02/23/h-is-for-hierarchyid.aspx#9913037</link><pubDate>Mon, 26 Oct 2009 16:57:39 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9913037</guid><dc:creator>Kevin</dc:creator><description>&lt;p&gt;'GetAncestor' ...&lt;/p&gt;
&lt;p&gt;See the method reference... it's all case sensitive as the hierarchyid is effectively a CLR: &lt;a rel="nofollow" target="_new" href="http://technet.microsoft.com/en-us/library/bb677193.aspx"&gt;http://technet.microsoft.com/en-us/library/bb677193.aspx&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9913037" width="1" height="1"&gt;</description></item><item><title>re: H is for… HierarchyID</title><link>http://blogs.msdn.com/b/jimoneil/archive/2009/02/23/h-is-for-hierarchyid.aspx#9904103</link><pubDate>Wed, 07 Oct 2009 07:18:05 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9904103</guid><dc:creator>Leon Han</dc:creator><description>&lt;p&gt;Thanks for the answer. I am surprised the Function is case sensitive!&lt;/p&gt;
&lt;p&gt;The error I got is:&lt;/p&gt;
&lt;p&gt;Msg 6506, Level 16, State 10, Line 15&lt;/p&gt;
&lt;p&gt;Could not find method 'getAncestor' for type 'Microsoft.SqlServer.Types.SqlHierarchyId' in assembly 'Microsoft.SqlServer.Types'&lt;/p&gt;
&lt;p&gt;Just put it here so anyone who may see this error can get the answer from here. :)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9904103" width="1" height="1"&gt;</description></item><item><title>re: H is for… HierarchyID</title><link>http://blogs.msdn.com/b/jimoneil/archive/2009/02/23/h-is-for-hierarchyid.aspx#9837580</link><pubDate>Fri, 17 Jul 2009 19:00:15 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9837580</guid><dc:creator>Jim O'Neil</dc:creator><description>&lt;p&gt;TBone, it's case-sensitive. &amp;nbsp;Try select hid.GetLevel() from x.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9837580" width="1" height="1"&gt;</description></item><item><title>re: H is for… HierarchyID</title><link>http://blogs.msdn.com/b/jimoneil/archive/2009/02/23/h-is-for-hierarchyid.aspx#9837565</link><pubDate>Fri, 17 Jul 2009 18:49:44 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9837565</guid><dc:creator>TBone</dc:creator><description>&lt;p&gt;Cant get it to work - Real simple example:&lt;/p&gt;
&lt;p&gt;create table x (hid hierarchyid)&lt;/p&gt;
&lt;p&gt;select hid.getlevel() from x&lt;/p&gt;
&lt;p&gt;Msg 6506, Level 16, State 10, Line 1&lt;/p&gt;
&lt;p&gt;Could not find method 'getlevel' for type 'Microsoft.SqlServer.Types.SqlHierarchyId' in assembly 'Microsoft.SqlServer.Types'&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9837565" width="1" height="1"&gt;</description></item></channel></rss>