Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Parent and child

Author  Topic 

carlossiwaily
Starting Member

24 Posts

Posted - 2007-12-02 : 02:39:49
hellp
I have table as follow

pageid, parentid, text

1 -1 page1
2 2 page2
3 -1 page3
4 2 page4

I want A SQL STATMENT WHERE GET PARENTID THEN ALL IT'S CHILD
E,G
PAGEID, PARENTID TEXT
1 -1 PAGE1
2 2 PAGE2
4 2 PAGE4
3 -1 PAGE4

thanks



carlossiwaily

nr
SQLTeam MVY

12543 Posts

Posted - 2007-12-03 : 12:53:06
see
http://www.nigelrivett.net/SQLTsql/RetrieveTreeHierarchy.html

(In 2005 you would do it using a CTE)

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page
   

- Advertisement -