Professional Documents
Culture Documents
Duplicate Budgets - Budgets Not Saving
Duplicate Budgets - Budgets Not Saving
To fix this:
The script below will find and delete duplicated budget records. Once this is done these
budgets will need to be recaptured:
delete from _etblBudgets
where idBudgets not in
(
select idBudgets from
(
select idBudgets = min(B.idBudgets), B.iBudgetAccountID,
B.iBudgetProjectID, B.iBudgetPeriodID, B.iBudgetTxBranchID
from _etblBudgets B
left join (
select iBudgetAccountID, iBudgetProjectID,
iBudgetPeriodID, iBudgetTxBranchID, [count] = count(*)
from _etblBudgets
group by iBudgetAccountID, iBudgetProjectID,
iBudgetPeriodID, iBudgetTxBranchID
having count(*) > 1
) DUPL -- Duplicates
on DUPL.iBudgetAccountID = B.iBudgetAccountID
and DUPL.iBudgetProjectID = B.iBudgetProjectID
and DUPL.iBudgetPeriodID = B.iBudgetPeriodID
and DUPL.iBudgetTxBranchID = B.iBudgetTxBranchID
group by B.iBudgetAccountID, B.iBudgetProjectID, B.iBudgetPeriodID,
B.iBudgetTxBranchID
) EXCL -- Exclude List
)
Please not that this script is for Version 7, 7.00.207, and might not work on older
version due to table and field name references.