Delete From BasicPremium where PlanInternalno = 771
delete from Bonus
delete from FinalAdditionalBonus
delete From Loyalty

update CommissionRate set CommissionRateInternalNo = CommissionRateInternalNo + 8622900
where PlanInternalno = 871
and Mode <> 'Q'

delete From CommissionRate Where PlanInternalno = 771

insert into CommissionRate(PlanInternalNo, CommissionRateInternalNo, FromTerm, ToTerm, ToPolicyYear, FromPolicyYear, Mode, Percentage, BonusRate, FromPremium, ToPremium)
select 771, CommissionRateInternalNo - 1000000, FromTerm, ToTerm, ToPolicyYear, FromPolicyYear, Mode, Percentage, BonusRate, FromPremium, ToPremium
from commissionRate 
Where commissionRate.PlanInternalno = 871



