use laizhou_mangguo SELECT * FROM TConsumeBill WHERE FCompId = 5811579782769424104 SELECT * FROM TCompany UPDATE TCompany SET FDeleted = 1,FNo = FNo + '已删' WHERE FId = 5811579782769424104 UPDATE TCompany SET FDeleted = 0,FNo = FNo + '已删' WHERE FId = 5811579782769424104 SELECT * FROM TItem SELECT * FROM TItemSub WHERE FCompId = 5811579782769424104 SELECT * SELECT * FROM TMemberCardType EXEC PCopyTable 'db186.LaiZhou_QiaoSi.dbo.TMemberCardType','TMemberCardType',' AND FNo LIKE ''B%''' SELECT * FROM qd11.LaiZhou_QiaoSi.dbo.TMemberCardType SELECT * FROM TBasicTYPE WHERE FKey = 'GoodsType' UPDATE TBasicTYPE SET FNo = REPLACE(FNo, 'B','') + FNo WHERE FNo >= '5' AND FNo LIKE 'B%' SELECT * FROM TBasicTYPE WHERE FNo >= '5' SELECT * FROM TMemberCard WHERE FCompId = 5811579782769424104 AND FCardId IN(SELECT FCardId FROM TConsumeBill WHERE FCompId != 5811579782769424104) SELECT * FROM TMemberCard WHERE FCompId != 5811579782769424104 AND FCardId IN(SELECT FCardId FROM TConsumeBill WHERE FCompId = 5811579782769424104) SELECT ' DELETE ' + name + ' WHERE FBillId IN(SELECT FBillId FROM TConsumeBill WHERE FCompId = 5811579782769424104)' FROM sys.objects WHERE name like 'TConsume%' ORDER BY name DESC DELETE TConsumeReturnVisit WHERE FBillId IN(SELECT FBillId FROM TConsumeBill WHERE FCompId = 5811579782769424104) DELETE TConsumeItemPayment WHERE FBillId IN(SELECT FBillId FROM TConsumeBill WHERE FCompId = 5811579782769424104) DELETE TConsumeItemEmployee WHERE FBillId IN(SELECT FBillId FROM TConsumeBill WHERE FCompId = 5811579782769424104) DELETE TConsumeItemCostGoods WHERE FBillId IN(SELECT FBillId FROM TConsumeBill WHERE FCompId = 5811579782769424104) DELETE TConsumeItem WHERE FBillId IN(SELECT FBillId FROM TConsumeBill WHERE FCompId = 5811579782769424104) DELETE TConsumeGoodsPayment WHERE FBillId IN(SELECT FBillId FROM TConsumeBill WHERE FCompId = 5811579782769424104) DELETE TConsumeGoodsEmployee WHERE FBillId IN(SELECT FBillId FROM TConsumeBill WHERE FCompId = 5811579782769424104) DELETE TConsumeGoods WHERE FBillId IN(SELECT FBillId FROM TConsumeBill WHERE FCompId = 5811579782769424104) DELETE TConsumeBill WHERE FBillId IN(SELECT FBillId FROM TConsumeBill WHERE FCompId = 5811579782769424104) DELETE TMemberSaleRepay WHERE FBillId IN(SELECT FBillId FROM TMemberSaleBill WHERE FCompId = 5811579782769424104) DELETE TMemberSalePayment WHERE FBillId IN(SELECT FBillId FROM TMemberSaleBill WHERE FCompId = 5811579782769424104) DELETE TMemberSaleInfo WHERE FBillId IN(SELECT FBillId FROM TMemberSaleBill WHERE FCompId = 5811579782769424104) DELETE TMemberSaleFreeItem WHERE FBillId IN(SELECT FBillId FROM TMemberSaleBill WHERE FCompId = 5811579782769424104) DELETE TMemberSaleExchangeTarget_Old WHERE FBillId IN(SELECT FBillId FROM TMemberSaleBill WHERE FCompId = 5811579782769424104) DELETE TMemberSaleExchangeSource WHERE FBillId IN(SELECT FBillId FROM TMemberSaleBill WHERE FCompId = 5811579782769424104) DELETE TMemberSaleExchange WHERE FBillId IN(SELECT FBillId FROM TMemberSaleBill WHERE FCompId = 5811579782769424104) DELETE TMemberSaleEmployee WHERE FBillId IN(SELECT FBillId FROM TMemberSaleBill WHERE FCompId = 5811579782769424104) DELETE TMemberSaleDetailSplit WHERE FBillId IN(SELECT FBillId FROM TMemberSaleBill WHERE FCompId = 5811579782769424104) DELETE TMemberSaleDetailPayment WHERE FBillId IN(SELECT FBillId FROM TMemberSaleBill WHERE FCompId = 5811579782769424104) DELETE TMemberSaleCoursePack WHERE FBillId IN(SELECT FBillId FROM TMemberSaleBill WHERE FCompId = 5811579782769424104) DELETE TMemberSaleCourseGoods WHERE FBillId IN(SELECT FBillId FROM TMemberSaleBill WHERE FCompId = 5811579782769424104) DELETE TMemberSaleCourse WHERE FBillId IN(SELECT FBillId FROM TMemberSaleBill WHERE FCompId = 5811579782769424104) DELETE TMemberSaleCombo WHERE FBillId IN(SELECT FBillId FROM TMemberSaleBill WHERE FCompId = 5811579782769424104) DELETE TMemberSaleCard WHERE FBillId IN(SELECT FBillId FROM TMemberSaleBill WHERE FCompId = 5811579782769424104) DELETE TMemberSaleBill WHERE FBillId IN(SELECT FBillId FROM TMemberSaleBill WHERE FCompId = 5811579782769424104) SELECT ' DELETE ' + name + ' WHERE FMemId IN(SELECT FBillId FROM TConsumeBill WHERE FCompId = 5811579782769424104)' FROM sys.objects WHERE name like 'TMember%' ORDER BY name DESC DELETE TMember WHERE FCompId = 5811579782769424104 DELETE TMemberCard WHERE FCompId = 5811579782769424104 DELETE TMemberCardAccount WHERE FMemId IN(SELECT FMemId FROM TMember WHERE FCompId = 5811579782769424104 ) DELETE TMemberCardAcctHist WHERE FMemId IN(SELECT FMemId FROM TMember WHERE FCompId = 5811579782769424104 ) DELETE TMemberTransHist WHERE FMemId IN(SELECT FMemId FROM TMember WHERE FCompId = 5811579782769424104 ) DELETE TMemberCardAcctHist WHERE FMemId IN(SELECT FMemId FROM TMember WHERE FCompId = 5811579782769424104 ) DELETE TMemberArrear WHERE FMemId IN(SELECT FMemId FROM TMember WHERE FCompId = 5811579782769424104 ) DELETE TMemberCardMerge WHERE FMemId IN(SELECT FMemId FROM TMember WHERE FCompId = 5811579782769424104 ) DELETE TMemberCardMergeDetail WHERE FMemId IN(SELECT FMemId FROM TMember WHERE FCompId = 5811579782769424104 ) DELETE TMemberCardTransfer WHERE FMemId IN(SELECT FMemId FROM TMember WHERE FCompId = 5811579782769424104 ) DELETE TMemberChangeLog WHERE FMemId IN(SELECT FMemId FROM TMember WHERE FCompId = 5811579782769424104 ) DELETE TMemberCourse WHERE FMemId IN(SELECT FMemId FROM TMember WHERE FCompId = 5811579782769424104 ) DELETE TMemberPhoto WHERE FMemId IN(SELECT FMemId FROM TMember WHERE FCompId = 5811579782769424104 ) DELETE TMemberPointHist WHERE FMemId IN(SELECT FMemId FROM TMember WHERE FCompId = 5811579782769424104 ) DELETE TGoodsSub WHERE FCompId = 5811579782769424104 DELETE TItemSub WHERE FCompId = 5811579782769424104 DELETE TEmployeeSub WHERE FCompId = 5811579782769424104 DELETE TMemberCardTypeSub WHERE FCompId = 5811579782769424104 DELETE TGoods WHERE FId NOT IN(SELECT FGoodsId FROM TGoodsSub ) AND FId > 0 DELETE TItem WHERE FId NOT IN(SELECT FItemId FROM TItemSub ) AND FId > 0 DELETE TEmployee WHERE FId NOT IN(SELECT FEmpId FROM TEmployeeSub ) AND FId > 0 DELETE TMemberCardType WHERE FId NOT IN(SELECT FCardTypeId FROM TMemberCardTypeSub ) AND FId > 0 SELECT * FROM TInventory DELETE TInventory WHERE FCompId = 5811579782769424104 DELETE TInventoryHist WHERE FCompId = 5811579782769424104 SELECT * FROM TMemberCard WHERE FCompId = 1 SELECT * FROM TLoginSession WHERE FUserType = 'PCClient' ORDER BY FLoginTIME DESC EXEC PChangeCenterCompany '001' DELETE TCompanyTree DELETE TCompany WHERE FNo IN('000','002已删已删已删') SELECT * FROM TCompany DELETE TWebAppInfoSub WHERE FCompId NOT IN(SELECT FId FROM TCompany) SELECT * FROM TWebAppInfo