title: Find all leaf node records using hierarchyid
body: <p>How would I go about querying for only records that are "only leaf nodes"
  (ie. no children)?</p>
  
  <p>I have tried a query like this:</p>
  
  <pre><code>select *
  from TableA tt
  where tt.HierarchyId.GetDescendant(null, null) not in 
  (
      Select  t.HierarchyId
      from TableA t
  )
  </code></pre>
  
  <p>But this still seemed to return some nodes that had children.</p>
  
  <p>I am using the built-in hierarchyid data type (part of ms sqlserver)</p>