Skip to content Skip to sidebar Skip to footer

How To Generate Mssql Hierarchy Id For Each Element For A Tree Object

I've a requirement like dragable tree in my project. I've successfully converted mssql resultset to json. But the end user is again dragging and dropping and totally changed the tr

Solution 1:

Following the link you posted to the other SO question, and then a link from a comment, I see you are using the MSSQL hierarchyid data type (hint: it might have helped if you been a bit clearer about that in your question ;)

From the online help I see there is a Parse function, which takes a string.

So you need to traverse your JSON tree structure, building strings for each element in the form /1/1/3/ for example, and pass those back to your database along with the associated node id.

Post a Comment for "How To Generate Mssql Hierarchy Id For Each Element For A Tree Object"