Now that you’ve populated the hierarchy, you should query it to view the data and verify the hierarchy was populated correctly. However, If you query the
hid value directly, you see only its binary representation, which is not very meaningful. To view the
Hierarchyid value in a more useful manner, you can use the
ToString method, which returns a logical string representation of the
Hierarchyid. This string representation is shown as a path with a slash sign used as a separator between the levels. For example, you can run the following query to get both the binary and logical representations of the
select cast(hid as varbinary(6)) as hid, substring(hid.ToString(), 1, 12) as ...