hierarchyid
Hierarchyid is a built-in system data type in Microsoft SQL Server used to store the position of a node within a hierarchy. It represents the node’s location as a binary value that encodes the path in a tree, and it can be displayed as a human-readable string such as /1/2/3/. The type is designed to support efficient querying and ordered traversal of hierarchical data and can be indexed to improve performance for common operations.
The hierarchyid type provides a set of methods for path construction, navigation, and relationship checks, including
Typical usage involves tables that model trees with a hierarchyid column, for example a table with columns
Considerations include the cost of updating paths for large subtrees when nodes are moved, since descendants