如何用语句快速删除用友U8的帐套

如何用语句快速删除用友U8的帐套

用友知识库用友软件2018-10-04 18:52:226350A+A-

问题现象:如何用语句快速删除用友U8ERP软件中的帐套  ?因升级帐套太多,手工删除太慢

解决方案: 提供语句解决:

DECLARE @AccID char(3)

微信号:yyrjlls
扫码 有偿解决 用友软件技术问题!
复制微信号

SET @AccId = '112'--在此修改账套号

USE UFSYSTEM

DELETE FROM UA_BackupLog WHERE cAcc_Id=@AccId

DELETE FROM UA_BackupPlans WHERE cAcc_Id=@AccId

DELETE FROM UA_BackupPlan WHERE cPlan_Id not in (select cPlan_Id FROM UA_BackupPlans)

DELETE FROM UA_HoldAuth WHERE cAcc_Id=@AccId

DELETE FROM UA_Auth WHERE cAcc_Id=@AccId

DELETE FROM UA_FlowItems WHERE cAccId=@AccId

DELETE FROM UA_FlowLines WHERE cAccId=@AccId

DELETE FROM UA_Identity WHERE cAcc_Id=@AccId

DELETE FROM UA_Account_sub WHERE cAcc_Id=@AccId

DELETE FROM UA_Log WHERE cAcc_Id=@AccId

DELETE FROM UA_Period WHERE cAcc_Id=@AccId

DELETE FROM UA_Account WHERE cAcc_Id=@AccId

DELETE FROM UA_Message WHERE Account=@AccId

DELETE GDP_JccpConfigure WHERE UF_DB_NAME=@AccId

USE master

DECLARE AccCur CURSOR

FOR SELECT NAME FROM sysdatabases

DECLARE @AccName varchar(40)

OPEN AccCur

FETCH NEXT FROM AccCur INTO @AccName

WHILE (@@fetch_status <>; -1)

BEGIN

IF (@@fetch_status <>; -2)

BEGIN

IF (left(@AccName,10)='UFDATA_' + @AccId) and len(@AccName)=15

BEGIN

EXECUTE sp_detach_db @AccName

--PRINT '账套库'+@AccName + '已分离!'

END

END

FETCH NEXT FROM AccCur INTO @AccName

END

CLOSE AccCur

DEALLOCATE AccCur

SELECT '账套'+@AccId+'删除完成!'

点击这里复制本文地址 以上内容由用友财务软件免费试用版下载整理呈现,请务必在转载分享时注明本文地址!如对内容有疑问,请联系我们,谢谢!

用友财务软件免费试用版下载 © All Rights Reserved.  

copyright © 2011-2025 new.aiufida.com .