Click here to Skip to main content
14,427,367 members
Rate this:
Please Sign up or sign in to vote.
See more:
I have SQL table for Binary tree.

Id | Name | Parent_ID |

i want to calculate 5 levels of complete binary tree for parameter node which is passed to stored procedure.

What I have tried:

Recursive function
Using while loop
Updated 9-Jan-20 2:03am
OriginalGriff 9-Jan-20 5:59am
So show us what you have tried, explain what it did that you didn't expect or didn't do that you did, tell us what you have tried to fix that.
Tell use where you are stuck, what help you need.

Use the "Improve question" widget to edit your question and provide better information.
Member 14221689 10-Jan-20 2:35am
Hi i Have already tried that, but i am confuse how exactly i can do that.
OriginalGriff 10-Jan-20 3:13am
Show us the code that didn't work, explain what it did.
Just hover your mouse over the question until you see "Improve question" in green at the bottom, and click it. That will let you edit the question and provide us with actual information.

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 1

For MS SQL Server, please read this: Hierarchies WITH Common Table Expressions | Microsoft Docs[^]

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100