Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Connect By in SQL Server 2000

Connect By in SQL Server 2000

From: Simon <aaronss_at_the-mdu.com>
Date: 4 Nov 2002 06:23:18 -0800
Message-ID: <f526ea06.0211040623.1195031b@posting.google.com>


Hi

I realise that this is the Oracle group, but I am in search of a decent PL/SQL to T-SQL translator...

Here goes...

I am trying to run a query in an SQL Server 2000 database.

Simply, with regards to the application, I need to see how many children there are under the parent.

Apparently, in Oracle you might use something called Connect By:

E.g.

select dataid, name
from dtree
start with dataid = 12104040
connect by prior dataid = parentid

So where the parent had an identification number, so does the child. I need to see how many children, in total, are under the parent. I guess one might use hierarchical queries but I wouldn't really know where to start without having to type pages and pages of T-SQL. Is there an easier solution?

As ever, a pint of Champagne to the winner and a Magnum of Bud to all others for assistance... ;-)

Thanks in advance.

Simon Received on Mon Nov 04 2002 - 08:23:18 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US