删除已停用的客户,供应商.部门档案的SQL语句
删除已停用的客户,供应商.部门档案的SQL语句 txt文件 下载,备用,谢谢 不是吧.要是以后,再来了.怎么办. 下载,备用,谢谢 连这个也上传啊. 学习中。。。。。。。:handshake 不错的资料。下载学习中..... 恢复期末处理是不是很慢的 下载学习,语句删除还是快 好像不错的样子哦。 删除已停用的客户,供应商.部门档案的SQL语句Delete
from Inventory
where
not exists(select * from CurrentStock
where Inventory.cInvCode=CurrentStock.cInvCode) --现存量表
and not exists(select * from IA_Subsidiary
where Inventory.cInvCode=IA_Subsidiary.cInvCode) --发票表
and not exists(select * from RdRecords
where Inventory.cInvCode=RdRecords.cInvCode) --收发货记录表
and not exists(select * from pursettlevouchs
where Inventory.cInvCode=pursettlevouchs.cInvCode) --采购结算单子表
and not exists(select * from sa_invuprice
where Inventory.cInvCode=sa_invuprice.cInvCode) --销售报价表
and not exists(select * from Dispatchlists
where Inventory.cInvCode=Dispatchlists.cInvCode) --发货单列表
and not exists(select * from ProductStructuresEx
where Inventory.cInvCode=ProductStructuresEx.cPSPCode)--产品结构母产品
and not exists(select * from ProductStructuresEx
where Inventory.cInvCode=ProductStructuresEx.cPSCode) --产品结构子产品
and not exists(select * from PriceJustify
where Inventory.cInvCode=PriceJustify.cInvCode) --销售调价记录表
and not exists(select * from SO_SODetails
where Inventory.cInvCode=SO_SODetails.cInvCode) --销售订单子表
and not exists(select * from PurBillVouchs
where Inventory.cInvCode=PurBillVouchs.cInvCode) --采购发票子表
and dEDate is not null --已停用产品
--=======================================删除停用的客户档案
Delete
from customer
where
not exists(select * from Dispatchlist
where customer.cCusCode=Dispatchlist.cCusCode) --发货单列表
and not exists(select * from gl_accass
where customer.cCusCode=gl_accass.ccus_id) --辅助总账
and not exists(select * from GL_accvouch
where customer.cCusCode=GL_accvouch.ccus_id) --凭证及明细账
and not exists(select * from SO_SOmain
where customer.cCusCode=SO_SOmain.cCusCode) --销售订单主表
and not exists(select * from SA_QuoDetails
where customer.cCusCode=SA_QuoDetails.cCusCode)--销售报价表
anddEndDate is not null --已停用标志
---------------------s---o---f----t----b---b----s----.-----n---e---t----------------------
----------================================删除停用的供应商档案
Delete
from Vendor
where
not exists(select * from po_pomain
where Vendor.cvencode=po_pomain.cvencode) --采购订单主表
and not exists(select * from gl_accass
where Vendor.cvencode=gl_accass.csup_id) --辅助总账
and not exists(select * from GL_accvouch
where Vendor.cvencode=GL_accvouch.csup_id) --凭证及明细账
and not exists(select * from RdRecord
where Vendor.cvencode=RdRecord.cvencode) --收发货记录表
and not exists(select * from Ven_Inv_Price_Rule
where Vendor.cvencode=Ven_Inv_Price_Rule.cvencode) --供应商报价
anddEndDate is not null --已停用标志
页:
[1]