系统预置薪资项目编号修改(编号被占用的情况下,导致预置项目失败)

by 刘强亚 2016.12.7 15:12

注:脚本执行有风险,对于客户正式环境请在研发指导下执行。

注:脚本执行有风险,对于客户正式环境请在研发指导下执行。

 

--修改系统薪资项目编码
declare @constCode varchar(20)
set @constCode='Pay_System_'--可变值
declare @id bigint
declare OrgCur cursor
for select distinct a.id  from Base_Organization a left join Base_Organization_Trl b on a.ID=b.ID where IsHrOrg=1
open OrgCur
fetch next from OrgCur into @ID
while(@@FETCH_STATUS=0)
begin

declare @payID bigint
declare SalaryItemCur cursor
for select id  from [Pay_SalaryItem]  where  Org=@ID and IsSystemItem=1--取出系统项
open SalaryItemCur
fetch next from SalaryItemCur into @payID
while(@@FETCH_STATUS=0)
begin

if((select SUBSTRING(Code,0,12) from [Pay_SalaryItem]where ID=@payID and  Org=@ID)!=@constCode)
update [Pay_SalaryItem] set Code=@constCode+Code where ID=@payID and  Org=@ID

fetch next from SalaryItemCur into @payID--提前下一位信息
end
close SalaryItemCur --关闭游标
deallocate SalaryItemCur---删除游标


fetch next from OrgCur into @id--提前下一位信息
end
close OrgCur --关闭游标
deallocate OrgCur---删除游标

系统薪资项目编号修改.sql (987.00 bytes)

Tags:

评论 (2) -

Bayer Leverkusen fc tröja 美国 wrote at 2019/6/5 0:29:00 #

What's up all, here every person is sharing these knowledge, therefore it's pleasant to read this blog, and I used to pay a quick visit this web site every day.  Manchester United fc tröja - http://www.programdersleri.com/ppp56006

Real Madrid tröja 美国 wrote at 2019/6/7 23:22:40 #

Nice post. I learn something totally new and challenging on sites I stumbleupon every day. It will always be helpful to read through articles from other writers and use something from other web sites.   Arsenal tröja - www.twincitiesvfp.org/...strojor-barn-p-423594.cfm

添加评论



biuquote
微笑得意调皮害羞酷大笑惊讶发呆喜欢可怜尴尬闭嘴噘嘴皱眉伤心抓狂呕吐坏笑漫骂发怒
Loading


RecentComments

评论 RSS

Statistics

989 篇文章
0 个单页
645240 条评论
11 次评分
208823 次访问
访问统计开始于 2019年12月15日
平均日访问 5354 次
当前 113 人在线