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


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

Re: Generating a tree structure from data

From rembrandt <batesbrandt@gmail.com>
Newsgroups comp.databases.ms-sqlserver
Subject Re: Generating a tree structure from data
Date 2011-06-29 04:47 -0700
Organization http://groups.google.com
Message-ID <ff2ba3c3-8d58-4e93-a9e2-0a1218fb3eea@j31g2000yqe.googlegroups.com> (permalink)
References <b8b37caa-5853-4a76-adc0-c5f0cc28a16a@a10g2000vbz.googlegroups.com>

Show all headers | View raw


On Jun 22, 5:40 am, Steve <steve.simp...@aircelle.com> wrote:
> 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

export your data out to a more logical table (temp) and run your query
there.

Back to comp.databases.ms-sqlserver | Previous | NextPrevious 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