You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
DSWMS/DB/sqlserver/清除指定客户的库存和相关数据.sql

28 lines
1.3 KiB
Transact-SQL

--select * from op_wms where CUSTOMERNAME='ÇൺºãÌì'
declare @customername varchar(50)
set @customername='ÇൺºãÌì'
delete from op_wms where CUSTOMERNAME=@customername
delete from OP_WMS_IN_PLAN where CUSTOMERNAME=@customername
delete from OP_WMS_OUT_PLAN where CUSTOMERNAME=@customername
delete from OP_WMS_IN_DO where CUSTOMERNAME=@customername
delete from OP_WMS_OUT_DO where CUSTOMERNAME=@customername
delete from OP_WMS_CHANGE where wmsid not in(select wmsid from op_wms)
delete from OP_WMS_PHYSICS where wmsid not in(select wmsid from op_wms)
delete from OP_WMS_PHYSICS_CHANGE where wmsid not in(select wmsid from op_wms)
delete from OP_WMS_LOGIC where wmsid not in(select wmsid from op_wms)
delete from OP_WMS_FEERATE_DETAIL where FEERATEID not in(select wmsid from op_wms) and FEERATEID not in(select FEERATEID from OP_WMS_FEERATE)
delete from ch_fee where bsno not in (select bsno from v_op_bs)
delete from OP_WMS_IN_PLAN_GOODS where WMSPLANID not in(select WMSPLANID from OP_WMS_IN_PLAN)
delete from OP_WMS_IN_DO_GOODS where WMSDOID not in(select WMSDOID from OP_WMS_IN_DO)
delete from OP_WMS_OUT_PLAN_DETAIL where WMSPLANID not in(select WMSPLANID from OP_WMS_OUT_PLAN)
delete from OP_WMS_OUT_DO_GOODS where WMSDOID not in(select WMSDOID from OP_WMS_OUT_DO)