用友U8 因升级帐套太多,手工删除太慢用友U8 因升级帐套太多,手工删除太慢
问题原因:因升级帐套太多,手工删除太慢 解决方法:提供语句解决:DECLARE @AccID char(3)SET @AccId = '112'--在此修改账套号USE UFSYSTEMDELETE FROM UA_BackupLog WHERE [email protected] FROM UA_BackupPlans WHERE [email protected] FROM UA_BackupPlan WHERE cPlan_Id not in (select cPlan_Id FROM UA_BackupPlans)DELETE FROM UA_HoldAuth WHERE [email protected] FROM UA_Auth WHERE [email protected] FROM UA_FlowItems WHERE [email protected] FROM UA_FlowLines WHERE [email protected] FROM UA_Identity WHERE [email protected] FROM UA_Account_sub WHERE [email protected] FROM UA_Log WHERE [email protected] FROM UA_Period WHERE [email protected] FROM UA_Account WHERE [email protected] FROM UA_Message WHERE [email protected] GDP_JccpConfigure WHERE [email protected] USE masterDECLARE AccCur CURSORFOR SELECT NAME FROM sysdatabasesDECLARE @AccName varchar(40)OPEN AccCurFETCH NEXT FROM AccCur INTO @AccNameWHILE (@@fetch_status <> -1)BEGINIF (@@fetch_status <> -2)BEGINIF (left(@AccName,10)='UFDATA_' + @AccId) and len(@AccName)=15BEGINEXECUTE sp_detach_db @AccName--PRINT [email protected] + '已分离!'ENDENDFETCH NEXT FROM AccCur INTO @AccNameENDCLOSE AccCurDEALLOCATE AccCurSELECT [email protected]+'删除完成!'
解决方案:
问题原因:因升级帐套太多,手工删除太慢 解决方法:提供语句解决:DECLARE @AccID char(3)SET @AccId = '112'--在此修改账套号USE UFSYSTEMDELETE FROM UA_BackupLog WHERE [email protected] FROM UA_BackupPlans WHERE [email protected] FROM UA_BackupPlan WHERE cPlan_Id not in (select cPlan_Id FROM UA_BackupPlans)DELETE FROM UA_HoldAuth WHERE [email protected] FROM UA_Auth WHERE [email protected] FROM UA_FlowItems WHERE [email protected] FROM UA_FlowLines WHERE [email protected] FROM UA_Identity WHERE [email protected] FROM UA_Account_sub WHERE [email protected] FROM UA_Log WHERE [email protected] FROM UA_Period WHERE [email protected] FROM UA_Account WHERE [email protected] FROM UA_Message WHERE [email protected] GDP_JccpConfigure WHERE [email protected] USE masterDECLARE AccCur CURSORFOR SELECT NAME FROM sysdatabasesDECLARE @AccName varchar(40)OPEN AccCurFETCH NEXT FROM AccCur INTO @AccNameWHILE (@@fetch_status <> -1)BEGINIF (@@fetch_status <> -2)BEGINIF (left(@AccName,10)='UFDATA_' + @AccId) and len(@AccName)=15BEGINEXECUTE sp_detach_db @AccName--PRINT [email protected] + '已分离!'ENDENDFETCH NEXT FROM AccCur INTO @AccNameENDCLOSE AccCurDEALLOCATE AccCurSELECT [email protected]+'删除完成!'
www.kuaiji66.com 天龙瑞德