金蝶提示違反違反了PRIMARY KEY約束,PK_POZnvBal,不能在對象POinvBal中插入重複鍵
一般是手動或者通過插件對數據庫進行了刪除操作造成的
原因:一是部份物料已經不存在,二是表中存在有以後期間的記錄
--解決方案
delete from poinvbal where fitemid not in (select fitemid from t_icitem)
delete from poinvbal where fyear=(
select fvalue from t_systemprofile where fcategory='ic' and fkey='currentyear'
) and fperiod>(select fvalue from t_systemprofile where fcategory='ic' and fkey='currentperiod')
--例如:違反了PRIMARY KEY約束,PK_ICInvBal,不能在對象ICinvBal中插入重複鍵處理方法
--Fyear(當前賬期年) --Fperiod(當前賬期月)
SELECT * FROM IcBal WHERE Fyear=2020 and Fperiod=1
--DELETE FROM IcBal WHERE Fyear=2020 and Fperiod=1
SELECT * FROM IcinvBal WHERE Fyear=2020 and Fperiod=1
--DELETE FROM IcinvBal WHERE Fyear=2020 and Fperiod=1