Re: recursive to tree conversion?
Posted in 1996
Topics: Connectivity: ESQL/C, 4GL & Embedded SQL
Robert Donat wrote: > > Has anyone written a procedure or ESQL program which converts a > recursive table (ie employee/supervisor) into a tree structure type > table (ie left/right [in/out], level)? Well, I'm sure someone has. The > question is does anyone know where I might look at such code? Platform > independent. Makes no difference to me. I believe one of the Transact-SQL manuals which comes with Microsoft SQL Server contains some sample code for unrolling a hierarchical table. I used it a couple years ago to generate reports from hierarchical data. To generate the output, it temporarily stores the data in a flat table with level information (if I recall correctly). That intermediate data sounds like what you are looking for. I know the book(s) I am referring to were part of the SQL Server 4.2 reference set, but I do not recall if the example is still in the 6.0 books. Tony Hamilton Advanced Programming Institute