This code here does not work when I try to find a single parent node
declare @val hierarchyid
select @val = dbo.GetHierarchyIDbyID(30)
--get the parent
select * from NodeHierarchy
where @val.GetAncestor(NodeHierarchyID) = 1
How would you go about finding the parent?