针对ufsystem
select * from Rpt_GlbDEF 报表功能互斥
不同年帐套不同权限拷贝
insert into UA_HoldAuth
select _Id, case iYear when '2009' then '2008' end as iYear,cUser_Id,cAuth_Id,iIsUser from UA_HoldAuth
where _Id='007' and iYear='2009' and cUser_Id='LCL' and cAuth_Id not in
(select cAuth_Id from UA_HoldAuth where _Id='007' and iYear='2008' and cUser_Id='LCL')
同帐套复制权限
insert into UA_HoldAuth
select _Id, iYear,case cUser_Id when 'XY' then '06' end as cUser_Id,cAuth_Id,iIsUser
from UA_HoldAuth where cUser_Id='XY'and _Id='510' and iYear='2009'
选择权限复制
insert into UA_HoldAuth
select case _Id when '007' then '510' end as _Id , iYear,cUser_Id,cAuth_Id,iIsUser from UA_HoldAuth
where _Id='007' and iYear='2009' and cUser_Id='10' and cAuth_Id not in
(select cAuth_Id from UA_HoldAuth where _Id='510' and iYear='2009' and cUser_Id='10')
同年不同人物权限复制
insert into UA_HoldAuth
select _Id, iYear,case cUser_Id when '04' then '033' end as cUser_Id,cAuth_Id,iIsUser from UA_HoldAuth
where _Id='007' and iYear='2009' and cUser_Id='04' and cAuth_Id not in
(select cAuth_Id from UA_HoldAuth where _Id='007' and iYear='2009' and cUser_Id='033')
and left(cAuth_Id,3) in ('QM0','ST0','ASM')
针对各个主库内的 aa_holdauth
将新人加入每个员工权限内
insert into aa_holdauth (cUserid,cBusObId,ode,isUserGroup,cFuncId)
select distinct(cUserId) as cUserId ,
'user' as cBusObId,
'连书妍' as ode,
'0' as isUserGroup,
'R' as cFuncId
from aa_h
用友U861权限拷贝sql 来自淘豆网www.taodocs.com转载请标明出处.