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
/*
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:
<< Home
inventory journal
operation software
director software
driver software
factory software
pub software
baker software
baker software
county software
dancing log
operation software
director software
driver software
factory software
pub software
baker software
baker software
county software
dancing log
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
www.templatedesk.com
<< Home