用友软件免费下载(www.yongyou8.com)旨在提供全系列最新最全的用友财务软件免费下载地址。QQ群:498796122用友软件免费版用友软件破解版用友软件试用版

首页用友知识库正文

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

用友财务软件2016-09-15840

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

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

DECLARE @AccID char(3)

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+'删除完成!'

转载声明:本站发布文章及版权归原作者所有,转载本站文章请注明文章来源!

本文链接:https://www.yongyou8.com/zsk/pd4frf.html

网友评论