SELECT NodeId.ToString() AS NodeIdPath, dbo.fnGetFullDisplayPath(NodeId) AS NodeIdDisplayPath,*
FROM FAMILY
WHERE NodeId.GetAncestor(2) =
(SELECT NodeId
FROM FAMILY
WHERE FAMILYId = 11)
ORDER BY NodeLevel, NodeId
GO
NodeIdPathNodeIdDisplayPathNodeIdNodeLevelFamilyIdTitle
/1/1/1/爷爷 -> 父亲 -> 长子 -> 长孙0x5AD631111长孙
/1/2/1/爷爷 -> 父亲 -> 次子 -> 长女0x5B5631110长女
/1/2/2/爷爷 -> 父亲 -> 次子 -> 次孙0x5B5A31113次孙