December 2013
Intermediate to advanced
1872 pages
153h 31m
English
The script in Listing 45.31 performs the initial population of the Parts_hierarchy table. What if you need to add additional records into the table? Let’s look at how to use the GetDescendant method to add new records at different levels of the hierarchy.
For example, to add a child part to the Body node (node /2/), you can use the GetDescendant method without any arguments to add the new row below Body node at node /2/1/:
INSERT Parts_hierarchy (hid, partid, partname) select hid.GetDescendant(null, null), 25, 'left front fender' from Parts_hierarchy where partname = 'Body'
To add a new row as a higher descendant node at the same level as the left front fender inserted in ...