I have a table ‘tReferences’ with this fields:
IDFILE [int],
NAME [varchar(255)],
IDREFERENCE [int]
1 FILE1 0
2 FILE2 0
3 FILE3 0
4 FILE4 1
5 FILE5 4
6 FILE6 4
7 FILE7 2
8 FILE8 3
I have to create a recursive stored procedure that can show all references for a specifically IDFILE.
Results:
IDFILE NAME LEVEL
1 FILE1 0
4 FILE4 1
5 FILE5 2
6 FILE6 2
How can I do that?
Thank you very much.
To this I create a new temporary table:
and I populate this table in this way:
then, I return