October 2008
Beginner to intermediate
1024 pages
31h 30m
English
Three more hierarchyid methods—Parse, Read, and Write—are provided by the hierarchyid data type, although they are less often used.
Parse is essentially the reverse of ToString. It accepts the same slash-delimited string representation that is returned by ToString and returns the equivalent compacted varbinary hierarchyid value that SQL Server uses internally to represent the nodes. This value could then be passed to ToString, in which case you’d get the original slash-delimited string back. It is the only other static method besides GetRoot, so it uses the double-colon syntax, as follows:
SELECT hierarchyid::Parse('/2/1/1/') AS NodeId
GO
NodeId
----------
0x6AD6
(1 row(s) affected)Parse and ToString together enable serialization ...
Read now
Unlock full access