Tree structure queries | SQL Server Performance Forums

SQL Server Performance Forum – Threads Archive

Tree structure queries

Hi All, I have table called tbl_roles
column like
empid,
empname,
managerid,
manager name,
status. category like
Solultion head
Technical manager
Project manager
Team leader
senior Software engineer
software enginer
empid empname managerid managername
1 xxxx 101 yyyy
2 bbbb 101 yyyy
101 yyyy 102 b1111
102 b1111 103 CCCCC If Technical manager login (102 empid) , i need to display the
101
1
2
can u pls help me out
is this same ashttp://www.sql-server-performance.com/forum/topic.asp?TOPIC_ID=19795 ? —————————————-
Contributing Editor, Writer & Forums Moderator
http://www.SQL-Server-Performance.Com Visit my Blog at
http://dineshasanka.spaces.live.com/

I got the solution for this problem. Instead of writing the procedure, oracel having option called CONNECT BY Prior, any other equivalent options available in Sqlserver 2000 or 2005
Jeya
Please refrain posting duplicate posts for the same problem and would appreciate if you can post the solution too. Satya SKJ
Microsoft SQL Server MVP
Writer, Contributing Editor & Moderator
http://www.SQL-Server-Performance.Com
This posting is provided AS IS with no rights for the sake of knowledge sharing. The greatest discovery of my generation is that a human being can alter his life by altering his attitudes of mind.
quote:Originally posted by jeyakumars I got the solution for this problem. Instead of writing the procedure, oracel having option called CONNECT BY Prior, any other equivalent options available in Sqlserver 2000 or 2005
Apat from Satyas’ comment, if you are really using SQL Server 2005 you would want to check out Common Table Expressions (CTE) in BOL. There is no such feature as CONNECT BY in SQL Server. —
Frank Kalis
Moderator
Microsoft SQL Server MVP
Webmaster:http://www.insidesql.de
]]>