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

Path csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder3.hal-mli.net!news.alt.net!news.glorb.com!postnews.google.com!j31g2000yqe.googlegroups.com!not-for-mail
From rembrandt <batesbrandt@gmail.com>
Newsgroups comp.databases.ms-sqlserver
Subject Re: Generating a tree structure from data
Date Wed, 29 Jun 2011 04:47:55 -0700 (PDT)
Organization http://groups.google.com
Lines 36
Message-ID <ff2ba3c3-8d58-4e93-a9e2-0a1218fb3eea@j31g2000yqe.googlegroups.com> (permalink)
References <b8b37caa-5853-4a76-adc0-c5f0cc28a16a@a10g2000vbz.googlegroups.com>
NNTP-Posting-Host 71.101.83.66
Mime-Version 1.0
Content-Type text/plain; charset=ISO-8859-1
Content-Transfer-Encoding quoted-printable
X-Trace posting.google.com 1309348075 21056 127.0.0.1 (29 Jun 2011 11:47:55 GMT)
X-Complaints-To groups-abuse@google.com
NNTP-Posting-Date Wed, 29 Jun 2011 11:47:55 +0000 (UTC)
Complaints-To groups-abuse@google.com
Injection-Info j31g2000yqe.googlegroups.com; posting-host=71.101.83.66; posting-account=ky7sKgoAAABoQN3-k37m6grU8usIvYNO
User-Agent G2/1.0
X-Google-Web-Client true
X-Google-Header-Order ARLUEHNKC
X-HTTP-UserAgent Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Win64; x64; Trident/5.0),gzip(gfe)
Xref x330-a1.tempe.blueboxinc.net comp.databases.ms-sqlserver:485

Show key headers only | 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