SqlHierarchyId 구조

The SqlHierarchyId type represents a position in a hierarchical structure, specifying depth and breadth.

네임스페이스:  Microsoft.SqlServer.Types
어셈블리:  Microsoft.SqlServer.Types(Microsoft.SqlServer.Types.dll)

구문

‘선언
<CLSCompliantAttribute(True)> _
<SqlUserDefinedTypeAttribute(Format.UserDefined, IsByteOrdered := True,  _
    MaxByteSize := , Name := "SqlHierarchyId")> _
Public Structure SqlHierarchyId _
    Implements IBinarySerialize, INullable, IComparable
‘사용 방법
Dim instance As SqlHierarchyId
[CLSCompliantAttribute(true)]
[SqlUserDefinedTypeAttribute(Format.UserDefined, IsByteOrdered = true, 
    MaxByteSize = , Name = "SqlHierarchyId")]
public struct SqlHierarchyId : IBinarySerialize, 
    INullable, IComparable
[CLSCompliantAttribute(true)]
[SqlUserDefinedTypeAttribute(Format::UserDefined, IsByteOrdered = true, 
    MaxByteSize = , Name = L"SqlHierarchyId")]
public value class SqlHierarchyId : IBinarySerialize, 
    INullable, IComparable
[<SealedAttribute>]
[<CLSCompliantAttribute(true)>]
[<SqlUserDefinedTypeAttribute(Format.UserDefined, IsByteOrdered = true, 
    MaxByteSize = , Name = "SqlHierarchyId")>]
type SqlHierarchyId =  
    struct 
        interface IBinarySerialize 
        interface INullable 
        interface IComparable 
    end
Jscript는 구조체의 사용을 지원하지만 새로운 구조체 선언은 지원하지 않습니다.

SqlHierarchyId 유형에서 다음 멤버를 표시합니다.

속성

  이름 설명
공용 속성 IsNull Gets a value indicating whether the SqlHierarchyId is nullnull 참조(Visual Basic에서는 Nothing).
공용 속성정적 멤버 Null Gets a SqlHierarchyId with a hierarchy identification of nullnull 참조(Visual Basic에서는 Nothing).

맨 위로 이동

메서드

  이름 설명
공용 메서드 CompareTo(Object) Returns a value indicating the results of a comparison between a SqlHierarchyId and an object.
공용 메서드 CompareTo(SqlHierarchyId) Returns a value indicating the results of a comparison between two SqlHierarchyId nodes.
공용 메서드 Equals Evaluates whether SqlHierarchyId and obj are equal. (ValueType.Equals(Object)을(를) 재정의함)
공용 메서드 GetAncestor Retrieves the SqlHierarchyId node n levels up the hierarchical tree.
공용 메서드 GetDescendant Gets the value of a descendant SqlHierarchyId node that is greater than child1 and less than child2.
공용 메서드 GetHashCode Gets a hash of the path from the root node of the hierarchy tree to the SqlHierarchyId node. (ValueType.GetHashCode()을(를) 재정의함)
공용 메서드 GetLevel Gets a value indicating the level of the SqlHierarchyId node in the hierarchical tree.
공용 메서드 GetReparentedValue Gets a value representing the location of a new SqlHierarchyId node that has a path from newRoot equal to the path from oldRoot to this, effectively moving this to the new location.
공용 메서드정적 멤버 GetRoot Gets a value representing the root SqlHierarchyId node of the hierarchy.
공용 메서드 GetType (Object에서 상속됨)
공용 메서드 IsDescendantOf Gets a value indicating whether the SqlHierarchyId node is the descendant of the parent.
공용 메서드정적 멤버 Parse Converts the canonical string representation of a SqlHierarchyId node to a SqlHierarchyId value.
공용 메서드 Read Reads from a specified binary reader into a SqlHierarchyId.
공용 메서드 ToString Returns the canonical string representation of a SqlHierarchyId node from a SqlHierarchyId value. (ValueType.ToString()을(를) 재정의함)
공용 메서드 Write Writes a SqlHierarchyId to a specified binary writer.

맨 위로 이동

연산자

  이름 설명
공용 연산자정적 멤버 Equality Evaluates whether two SqlHierarchyId nodes are equal.
공용 연산자정적 멤버 GreaterThan Evaluates whether one specified SqlHierarchyId node is greater than another.
공용 연산자정적 멤버 GreaterThanOrEqual Evaluates whether one specified SqlHierarchyId node is greater than or equal to another.
공용 연산자정적 멤버 Inequality Evaluates whether two SqlHierarchyId nodes are unequal.
공용 연산자정적 멤버 LessThan Evaluates whether one specified SqlHierarchyId node is less than another.
공용 연산자정적 멤버 LessThanOrEqual Evaluates whether one specified SqlHierarchyId node is less than or equal to another.

맨 위로 이동

주의

This type provides the following benefits for storing hierarchical information:

  • Very compact data storage.

  • Depth-first comparison. Indexes on this type are in depth-first order, and nodes close to each other in a depth-first traversal are stored near each other.

  • Support for arbitrary insertions and deletions.

  • A limitation of this type is that a single instance of the hierarchy data type can be no larger than 892 bytes. Hierarchies that possess too many levels to fit within this limitation must use a different data type.

The HierarchyId type is available to CLR clients as the SqlHierarchyId data type.

DECLARE @employee hierarchyid
SELECT @employee = OrgNode FROM HumanResources.EmployeeDemo
  WHERE LoginID = 'adventure-works\dylan0'

SELECT * FROM HumanResources.EmployeeDemo
WHERE @employee.IsDescendantOf(OrgNode) = 1

스레드 보안

이 유형의 모든 공용 static(Visual Basic에서는 Shared) 멤버는 스레드로부터 안전합니다. 인스턴스 멤버는 스레드로부터의 안전성이 보장되지 않습니다.

참고 항목

참조

Microsoft.SqlServer.Types 네임스페이스