I am using HierarchyId in SQL server and I am referring the the article below to to get all the ancestors
https://technet.microsoft.com/en-us/library/bb677212%28v=sql.105%29.aspx
I have following code:
DECLARE @last_child HIERARCHYID
select *
FROM dbo.Geography AS g
WHERE @last_child.GetAncestor(1) = 0x58
SELECT @last_child
I do have a node with id 0x58 in DB and it does have a child. However, @last_child is coming back null constantly for some reason. Am I doing anything wrong?