List Info

Thread: SQL Recursion




SQL Recursion
user name
2006-11-14 19:14:09
Its all unlimited.

Duane

-----Original Message-----
From: Alan Wolfe [mailto:awolfedcshoes.com] 
Sent: Tuesday, November 14, 2006 2:33 PM
To: aspnet-databasesaspadvice.com
Subject: [aspnet-databases] RE: SQL Recursion

Hey Duane,

A question...does each node have a maximum number of
children it will
have or is that also unlimited?

-----Original Message-----
From: Duane Boudreau [mailto:duanesandybaynetworks.com] 
Sent: Tuesday, November 14, 2006 9:26 AM
To: aspnet-databasesaspadvice.com
Subject: [aspnet-databases] SQL Recursion

Is it possible to create a recursive query in SQLServer
2000?

I have a table that contains a parent/child record
relationship and I
want
to build a tree without client side processing.

ID Parent
1	Null
2	1
3	Null
4	2
5	1
6	Null
7	2
8	6

Needs to be sorted as
-1
  - 2
     - 4
     - 7
  - 5
-3
-6
  - 8

This example only shows 3 levels of data, but the real data
can go 15+
levels. The solutions I have found online do not handle
unlimited
levels.


TIA,
Duane




Need SQL Advice? http://sqladvice.com
Need RegEx Advice? http://regexadvice.com
Need XML Advice? http://xmladvice.com


Need SQL Advice? http://sqladvice.com
Need RegEx Advice? http://regexadvice.com
Need XML Advice? http://xmladvice.com




Need SQL Advice? http://sqladvice.com
Need RegEx Advice? http://regexadvice.com
Need XML Advice? http://xmladvice.com
[1]

about | contact  Other archives ( Real Estate discussion Medical topics )