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 |
|
mmalaka
Starting Member
33 Posts |
Posted - 2008-07-11 : 05:36:10
|
| Experts,I am looking for the best option to do the following:We have 2 Tables: Managers Tables and Employee TablesWe have a LookUp Table which include a field for the ManagerID and a field of EmployeeID. 1- The user will select a record from the Manager tables to get the Manager Details and use the ManagerID to get all the EmplyeeIDs for the ManagerIDselect EmployeeID from LookUP where ManagerID = var2- the the system will use the EmplyeeIDs to query the Emplyee Table to get the details of the EmplyeesSo the final result would be the deteails of the selected Manager and the details for all the Employee related to that managerHow to create a Stored Procedure to do this?Thanks in Advance |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-07-11 : 06:54:27
|
| Do you want this recursively? If yes, you could use a recursive CTE to achieve this if you're using sql 2005:-http://msdn.microsoft.com/en-us/library/ms186243.aspx |
 |
|
|
mmalaka
Starting Member
33 Posts |
Posted - 2008-07-11 : 07:23:49
|
| Yes I do this everytime the user slect a record in the manager tableI am using SQL 2000 |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-07-12 : 02:08:08
|
| Probably this is what you're looking at:-http://support.microsoft.com/kb/248915 |
 |
|
|
|
|
|