存储过程“sp_ManagersToUpdate”在每天执行名为AutoUser的计划任务后,针对员工更新新管理器。 但问题是..自从一个月以来就确定某些用户管理人员没有得到更新......它向老经理反对它。 我在“sp_ManagersToUpdate”存储过程中粘贴代码。 我需要分析为什么这些用户的经理没有得到更新。
select emp.EmployeeID,
emp.FirstName,
emp.LastName,
case
when ((rtrim(isnull(emps.exchange_id,'')) = rtrim(isnull(ex.manager,''))) and (rtrim(isnull(emps.exchange_id,'')) = rtrim(isnull(ad.manager,'')))) then 'Same'
else ''
end
as Same,
isnull(emps.exchange_id,'') as Employee_Manager,
isnull(ex.manager,'') as Exchange_Manager,
isnull(ad.manager,'') as AD_Manager,
ad.samaccountname as Logon,
ex.Email
from tb_employee emp
inner join tb_exchange ex
on emp.exchange_id = ex.adspath
inner join tb_ad ad
on emp.username = ad.samaccountname
inner join tb_employee_lawson l
on emp.employeeid = l.emp_empnum
inner join tb_supervisors s
on l.emp_supervisor = s.supervisorid
inner join tb_employee emps
on s.employeeid = emps.employeeid
where (emp.username > '')
and
((rtrim(isnull(emps.exchange_id,'')) <> rtrim(isnull(ex.manager,'')))
or (rtrim(isnull(emps.exchange_id,'')) <> rtrim(isnull(ad.manager,'')))
or (@ShowAllManagers = 1))
order by emp.employeeid