SqlHierarchyId 구조

SQL Server 2012

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 struct SqlHierarchyId : IBinarySerialize, 
	INullable, IComparable

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

  이름설명
공용 속성IsNullGets a value indicating whether the SqlHierarchyId is null.
공용 속성정적 멤버NullGets a SqlHierarchyId with a hierarchy identification of null.
맨 위로 이동

  이름설명
공용 메서드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.
공용 메서드EqualsEvaluates whether SqlHierarchyId and obj are equal. (ValueType.Equals(Object)을(를) 재정의함)
공용 메서드GetAncestorRetrieves the SqlHierarchyId node n levels up the hierarchical tree.
공용 메서드GetDescendantGets the value of a descendant SqlHierarchyId node that is greater than child1 and less than child2.
공용 메서드GetHashCodeGets a hash of the path from the root node of the hierarchy tree to the SqlHierarchyId node. (ValueType.GetHashCode()을(를) 재정의함)
공용 메서드GetLevelGets a value indicating the level of the SqlHierarchyId node in the hierarchical tree.
공용 메서드GetReparentedValueGets 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.
공용 메서드정적 멤버GetRootGets a value representing the root SqlHierarchyId node of the hierarchy.
공용 메서드GetType (Object에서 상속됨)
공용 메서드IsDescendantOfGets a value indicating whether the SqlHierarchyId node is the descendant of the parent.
공용 메서드정적 멤버ParseConverts the canonical string representation of a SqlHierarchyId node to a SqlHierarchyId value.
공용 메서드ReadReads from a specified binary reader into a SqlHierarchyId.
공용 메서드ToStringReturns the canonical string representation of a SqlHierarchyId node from a SqlHierarchyId value. (ValueType.ToString()을(를) 재정의함)
공용 메서드WriteWrites a SqlHierarchyId to a specified binary writer.
맨 위로 이동

  이름설명
공용 연산자정적 멤버EqualityEvaluates whether two SqlHierarchyId nodes are equal.
공용 연산자정적 멤버GreaterThanEvaluates whether one specified SqlHierarchyId node is greater than another.
공용 연산자정적 멤버GreaterThanOrEqualEvaluates whether one specified SqlHierarchyId node is greater than or equal to another.
공용 연산자정적 멤버InequalityEvaluates whether two SqlHierarchyId nodes are unequal.
공용 연산자정적 멤버LessThanEvaluates whether one specified SqlHierarchyId node is less than another.
공용 연산자정적 멤버LessThanOrEqualEvaluates 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) 멤버는 스레드로부터 안전합니다. 인스턴스 멤버는 스레드로부터의 안전성이 보장되지 않습니다.

커뮤니티 추가 항목

추가
표시: