Re: Recursive stored procedure ?
From: Roji. P. Thomas (lazydragon_at_nowhere.com)
Date: 06/23/04
- Next message: Craig G: "Re: Getting a list of Stored Procedures"
- Previous message: michael.osterkamp_at_nospam.titan.com: "Custom SQL SVR 2K Connection Management via NT Service"
- In reply to: Adrian Parker: "Recursive stored procedure ?"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 23 Jun 2004 18:24:14 +0530
This is the article Uri referred.
http://www.winnetmag.com/Article/ArticleID/16123/16123.html
--
Roji. P. Thomas
SQL Server Programmer
"Adrian Parker" <apparker@nospam.com> wrote in message
news:OAMSIJRWEHA.4056@TK2MSFTNGP11.phx.gbl...
> As I've not written anything but normal sql before, I've no idea if this
is
> even possible.
>
> I have a select where one of the arguments is a filter type, so what I'm
> doing is something like this..
>
> select a,b,c
> from table
> where (filtertype = 1 and
> val1 in (select val from tableA ))
> or (filtertype = 2 and
> val2 in (select val from tableB ))
>
> however, I now have to add a filtertype of 3 to select from a table where
> the results I need are selected recurively.
>
> e.g.
>
> create table post {
> post_id varchar(10) not null,
> manager varchar(10)
> }
>
> where manager will point to a post_id and will be null for the top level
> manager.
>
> What I need to do is given a post_id I need to find all subordinates down
> the tree, which can be of any depth.
>
> Any help would be much appreciated.
>
> --
> Adrian Parker
> Ingenuity @ Work Ltd
>
>
- Next message: Craig G: "Re: Getting a list of Stored Procedures"
- Previous message: michael.osterkamp_at_nospam.titan.com: "Custom SQL SVR 2K Connection Management via NT Service"
- In reply to: Adrian Parker: "Recursive stored procedure ?"
- Messages sorted by: [ date ] [ thread ]