SqlHierarchyId.GetAncestor(Int32) Method

Definition

Retrieves the SqlHierarchyId node n levels up the hierarchical tree.

[Microsoft.SqlServer.Server.SqlMethod(DataAccess=Microsoft.SqlServer.Server.DataAccessKind.None, InvokeIfReceiverIsNull=false, IsDeterministic=true, IsMutator=false, IsPrecise=true, OnNullCall=false, SystemDataAccess=Microsoft.SqlServer.Server.SystemDataAccessKind.None)]
public Microsoft.SqlServer.Types.SqlHierarchyId GetAncestor (int n);
[<Microsoft.SqlServer.Server.SqlMethod(DataAccess=Microsoft.SqlServer.Server.DataAccessKind.None, InvokeIfReceiverIsNull=false, IsDeterministic=true, IsMutator=false, IsPrecise=true, OnNullCall=false, SystemDataAccess=Microsoft.SqlServer.Server.SystemDataAccessKind.None)>]
member this.GetAncestor : int -> Microsoft.SqlServer.Types.SqlHierarchyId
Public Function GetAncestor (n As Integer) As SqlHierarchyId

Parameters

n
Int32

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

Returns

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.

Attributes

Applies to