I have a table with three columns NodeId, ParentNodeId, NodeName. for each node I would like to get a full path like “lvl1/lvl2/lvl3…” where lvl1,lvl2 and lvl3 are node names. I found a function which does that at this link http://www.sql-server-helper.com/functions/get-tree-path.aspx. but I would like to use CTE OR any other technique for efficiency. Please let me know if it is possible to achieve this in a better way. Thanks in advance.
I have a table with three columns NodeId, ParentNodeId, NodeName. for each node I
Share
Here’s a CTE version.