declare @y int,@p int
set @y=2015
set @p=3
Delete from t_Balance Where FYear = @y And FPeriod = @p
Delete from t_QuantityBalance Where FYear = @y And FPeriod = @p
Delete from t_ProfitAndLoss Where FYear = @y And FPeriod = @p
Delete t_subsys where Fnumber = 'Gl' and Fyear = @y and Fperiod = @p
Update t_subsys set Fused = -1 , FPeriodSynch = -1 , FCheckout = 0 where Fsubsysid = 1 and Fyear= @y and Fperiod = @p-1
if exists (select * from sysobjects where id = object_id(N't_scAccumulation') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
Delete from t_scAccumulation Where FYear = @y And FPeriod = @p-1
Update t_SystemProfile Set FValue = @p-1 Where FCategory = 'GL' And FKey = 'CurrentPeriod'
Update t_SystemProfile Set FValue = @y Where FCategory = 'GL' And FKey = 'CurrentYear'
推荐阅读