Freigeben über


HIERARCHYID Data Type in SQL Server 2008

HIERARCHYID Data Type in SQL Server 2008

SQL Server 2008 has introduced a new data type HIERARCHYID to store hierarchical data in database table. HIERARCHYID is a variable length system data type, and used to locate the position in the hierarchy of the element. The HIERARCHYID data type is optimized for representing trees, which are the most common type of hierarchal data. The HIERARCHYID data type should be used to represent the position in a hierarchy, that is, a column of type HIERARCHYID does not represent a tree itself, but rather it simply represents the position of a row/node within a defined tree. HIERARCHYID data type exposes many different methods which can be used to retrieve a list of ancestors and descendants as well as a means of traversing a tree etc. For more details click here.