Monday, March 14, 2005

 
List of Superiors

/*
Get the List of Superiors and their managers
*/

CREATE PROC dbo.getSuperiors
(@EmpId int)
AS
BEGIN
SET NOCOUNT ON
DECLARE @Path bigint

SELECT @Path = Path
FROM EmpHierarchy
WHERE EmpId = @EmpId


SELECT A.EmpId, A.EmpName AS Employee, C.EmpName As Manager
FROM EmpHierarchy A
LEFT JOIN EmpHierarchy C
ON A.ManagerId = C.EmpId
WHERE @Path % A.Hkey = 0
ORDER By A.Path DESC

END



Comments:
free themeforest templates from Template Plaza. If you need it, just cheek link and I'll pm you direct download link.
www.templatedesk.com
 
Post a Comment

<< Home

This page is powered by Blogger. Isn't yours?