从数据库反结账语句原创
金蝶云社区-新乡天旭王登云
新乡天旭王登云
4人赞赏了该文章 852次浏览 未经作者许可,禁止转载编辑于2020年07月30日 14:06:23

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'


图标赞 4
4人点赞
还没有人点赞,快来当第一个点赞的人吧!
图标打赏
0人打赏
还没有人打赏,快来当第一个打赏的人吧!