hierarchyid.ToString
tree navigation ToString
What changes
- Input
- hierarchyid instance and arguments
- Output or change
- nvarchar(4000)
- Return type
- SQL Server return type:nvarchar(4000) CLR return type:String
Syntax at a glance
node.ToString ( )
Work example
Display or export a hierarchy path as its slash-delimited representation.
Keep the hierarchyid value for joins and path operations, and convert to text only at a display boundary.
Check your work ToString returns a textual path and string sorting is not a substitute for hierarchyid ordering.
Practice SQL
Open in SQL FlowSELECT hierarchyid::Parse('/4/2/').ToString() AS display_path;
Open Microsoft Learn for full syntax, permissions, and details for your version.