Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

SqlHierarchyId.GetAncestor Method

Retrieves the SqlHierarchyId node n levels up the hierarchical tree.

Namespace:  Microsoft.SqlServer.Types
Assembly:  Microsoft.SqlServer.Types (in Microsoft.SqlServer.Types.dll)

[SqlMethodAttribute(DataAccess = DataAccessKind.None, SystemDataAccess = SystemDataAccessKind.None, 
	InvokeIfReceiverIsNull = false, OnNullCall = false, 
	IsDeterministic = true, IsPrecise = true, IsMutator = false)]
public SqlHierarchyId GetAncestor(
	int n


Type: Int32
An integer representing the number of levels to ascend in the hierarchy.

Return Value

Type: Microsoft.SqlServer.Types.SqlHierarchyId
SqlHierarchyId representing the nth ancestor of this.If a number greater than GetLevel is passed, null is returned.If a negative number is passed, an exception is raised indicating that the argument is out of range.

Community Additions

© 2015 Microsoft