用友财务软件免费试用版下载

网站首页 > 用友知识库 正文

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

用友财务软件 2018-10-04 18:52:22 用友知识库 488 ℃ 0 评论

问题现象:如何用语句快速删除用友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+'删除完成!'

本文暂时没有评论,来添加一个吧(●'◡'●)

欢迎 发表评论:

最近发表
标签列表