如何优雅的删库跑路原创
69次浏览
编辑于2024年11月20日 18:49:56
因个人原因需要删库跑路,我删除了一系列供应链的表和库存表
DELETE T_STK_INVENTORY DELETE T_STK_INVENTORYLOG DELETE dbo.T_PLN_RESERVELINK DELETE dbo.T_PLN_RESERVELINKENTRY DELETE dbo.T_PRD_INSTOCK DELETE dbo.T_PRD_INSTOCKENTRY
删完之后发现物料收发明细表崩盘了
根据SQL Profile 我跟踪到一段语句
SELECT 'STKINV', TSE.FSTOCKORGID fstockorgid, TSE.FOWNERTYPEID fownertypeid, VO.fitemid fownerid, TSE.FBALDATE fdate, -200 forderby, 'I' fstockio, TM.FMATERIALID fmaterialid, ISNULL(TSE.FAUXPROPID, 0) fauxpropid, ISNULL(TBLM.FNUMBER, ' ') flotno, ISNULL(TSE.FMTONO, ' ') fmtono, TBS.FSTOCKID fstockid, ISNULL(TSE.FSTOCKLOCID, 0) fstocklocid, TSE.FSTOCKSTATUSID fstockstatusid, TSE.FKEEPERTYPEID, VK.fitemid fkeeperid, CASE WHEN ( ( TMS.FISBATCHMANAGE = '1' AND TMS.FISKFPERIOD = '1' ) AND TMS.FISEXPPARTOFLOT = '1' ) THEN TBLM.FPRODUCEDATE ELSE TSE.FPRODUCEDATE END fproducedate, CASE WHEN ( ( TMS.FISBATCHMANAGE = '1' AND TMS.FISKFPERIOD = '1' ) AND TMS.FISEXPPARTOFLOT = '1' ) THEN TBLM.FEXPIRYDATE ELSE TSE.FEXPIRYDATE END fexpirydate, ISNULL(TB.FID, 0) fbomid, SUM(TSE.FBASEENDQTY) fbaseqcqty, SUM(TSE.FSECENDQTY) fbaseqcqty FROM T_STK_INVBAL TSE
这里我发现他查询了一个叫做库存余额的表,并且里面有个 keeperid 为空的数据,
那么好办了,我们直接就把这个表清空,
这下不报错了,,世界都清净了
赞 0
0人点赞
还没有人点赞,快来当第一个点赞的人吧!
打赏
0人打赏
还没有人打赏,快来当第一个打赏的人吧!