用友账套号修改及合并同账套多账套号多年度

用友账套号修改及合并同账套多账套号多年度
请仔细阅读代码后再小心使用
主要适用于将同一账套,单由于建账时分别使用了多账套号
例如:001-2005,002-2006,但确实是一个公司的帐,想合并成一个账套号,变成001账套种有2005-2006年度
【code】
--改 账套号工具,需要把数据库分离,改名
use ufsystem
declare @acc_from nchar(3),@acc_to nchar(3),@temp nchar(20)
set @acc_from='391' ---原账套号
set @acc_to='301' ---新账套号
---应该增加一行与661完全相同的401记录到ua_account_sub表
delete from ua_task where cacc_id=@acc_from
delete from ua_account_sub where cacc)id=@acc_from and iYear='9999'
update ua_account_sub set cAcc_id=@acc_to where cacc_id=@acc_from
update ua_period set cAcc_id=@acc_to where cacc_id=@acc_from
update ua_log set cacc_id=@acc_to where cacc_id=@acc_from
update ua_)holdAuth set cAcc_id=@acc_to where cacc_id=@acc_from

--应该删除661记录在ua_Account_sub表
delete from ua_account where cacc_id=@acc_from
【/code】

原文地址:https://www.cnblogs.com/martian6125/p/9631258.html