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.
Author |
Topic |
sanjay5219
Posting Yak Master
240 Posts |
Posted - 2013-09-03 : 09:47:20
|
Hi All,I have one table Emp_MAster with two column ID-Sup_Id. I need to create a table where i can store data link thisId-HreidOnly diffrence is that I need to store data in an hierarchy view so Emp 1 is reporting to Emp2 and Emp2 is reportign to Emp3 so in new table I should getEmp3-Emp2Emp3-Emp1Emp2-Emp1 |
|
James K
Master Smack Fu Yak Hacker
3873 Posts |
Posted - 2013-09-03 : 10:41:36
|
What do you want to see if you had more than one layer of management - for example, your data was like this:Id Sup_id1 22 33 4 Are you looking for the ultimate supervisor, or all the links in between? If it is the ultimate supervisor only, I guess it would be simple enough - just add the CEO or whomever is the big boss as the Hreid along with every employee's id as Id. If you are looking for all links, you will need to use a recursive scheme. |
|
|
sanjay5219
Posting Yak Master
240 Posts |
Posted - 2013-09-03 : 17:48:26
|
Yes I am looking something recursive scheme |
|
|
|
|
|