Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
jiyajk
Starting Member
1 Post |
Posted - 2010-10-26 : 01:16:07
|
HiI have a table which stores data in the binary tree structure format.The issue here is : when the total number of child nodes of a node is 14, then the same node should be inserted in the tree as a child node. This goes for each node of the binary tree.E.g.; consider the root node 002. After the child node 051 has been inserted, the number of child nodes of 002 will be 14 and then the node 002 should be automatically added as a child node in the binary tree. And then for the next node 005, the total number of child nodes becomes 14 (after the child 095 has been inserted), 005 should be automatically inserted as a child node in the tree and this process goes on…Userid Parentid 002 0005 002007 002 010 005014 005 017 007020 007027 010030 010034 014035 014040 017043 017048 020051 020002 027056 027067 030075 030083 034088 034090 035095 035005 040 In this table, Userid is the foreign key. In the table where Userid is a primary key, Userid is an IDENTITY column. can anyone please let me know the stored procedure logic for getting the solution for the above?- Thanks in advance |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2010-10-26 : 03:20:48
|
Lumbago, where is your previous answer? N 56°04'39.26"E 12°55'05.63" |
 |
|
|
|
|