Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.databases.ms-sqlserver > #474

Generating a tree structure from data

From Steve <steve.simpson@aircelle.com>
Newsgroups comp.databases.ms-sqlserver
Subject Generating a tree structure from data
Date 2011-06-22 02:40 -0700
Organization http://groups.google.com
Message-ID <b8b37caa-5853-4a76-adc0-c5f0cc28a16a@a10g2000vbz.googlegroups.com> (permalink)

Show all headers | View raw


Hi,

I've been banging my head against a brick wall trying to sort this and
hoping somebody can help!!!

i have a table that has 4  main fields;
icode
idcode
parent
iddesc

parent is either blank, Y (meaning there are child links) and H
(meaning it's the top level of a structure)

icode is effectively the parent id and idcode is the child id

iddesc is the description of the link

I want to be able to create a procedure that recusively loops through
the table (intradtl) and outputs an indented structure of the file

Level    description
.0         <<iddesc>>
..1        <<iddesc>>
....2      <<iddesc>>
..1        <<iddesc>>
etc

can anyone offer any advice on how to do it?  i want to do it in as
simpler way as possible......

thanks in advance

Back to comp.databases.ms-sqlserver | Previous | NextNext in thread | Find similar


Thread

Generating a tree structure from data Steve <steve.simpson@aircelle.com> - 2011-06-22 02:40 -0700
  Re: Generating a tree structure from data Erland Sommarskog <esquel@sommarskog.se> - 2011-06-22 22:18 +0200
  Re: Generating a tree structure from data --CELKO-- <jcelko212@earthlink.net> - 2011-06-23 07:36 -0700
  Re: Generating a tree structure from data rembrandt <batesbrandt@gmail.com> - 2011-06-29 04:47 -0700

csiph-web