|
|
|
|
use ZhuCheng_NiHaoPiaoLiang
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TCompany
|
|
|
|
|
|
|
|
|
|
DELETE TConsumeBill WHERE FBillId IN(SELECT FBillId FROM TConsumeBill WHERE FCompId != 6475914903988698362 )
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SELECT ' DELETE ' + name + ' WHERE FBillId IN(SELECT FBillId FROM TConsumeBill WHERE FCompId != 6475914903988698362 )'
|
|
|
|
|
FROM sysobjects WHERE name LIKE 'TConsume%'
|
|
|
|
|
|
|
|
|
|
SELECT ' DELETE ' + name + ' WHERE FBillId IN(SELECT FBillId FROM TMemberSaleBill WHERE FCompId != 6475914903988698362 )'
|
|
|
|
|
FROM sysobjects WHERE name LIKE 'TMemberSale%'
|
|
|
|
|
|
|
|
|
|
SELECT ' DELETE ' + name + ' WHERE FBillId IN(SELECT FBillId FROM TOrderBill WHERE FCompId != 6475914903988698362 )'
|
|
|
|
|
FROM sysobjects WHERE name LIKE 'TOrder%'
|
|
|
|
|
|
|
|
|
|
SELECT ' DELETE ' + name + ' WHERE FBillId IN(SELECT FBillId FROM TOtherIncomeBill WHERE FCompId != 6475914903988698362 )'
|
|
|
|
|
FROM sysobjects WHERE name LIKE 'TOtherIncome%'
|
|
|
|
|
|
|
|
|
|
SELECT ' DELETE ' + name + ' WHERE FBillId IN(SELECT FBillId FROM TStockInBill WHERE FCompId != 6475914903988698362 )'
|
|
|
|
|
FROM sysobjects WHERE name LIKE 'TStockIn%'
|
|
|
|
|
|
|
|
|
|
SELECT ' DELETE ' + name + ' WHERE FBillId IN(SELECT FBillId FROM TStockOutBill WHERE FCompId != 6475914903988698362 )'
|
|
|
|
|
FROM sysobjects WHERE name LIKE 'TStockOut%'
|
|
|
|
|
|
|
|
|
|
SELECT FMemId INTO #Member FROM TMember WHERE FCompID != 6475914903988698362
|
|
|
|
|
|
|
|
|
|
SELECT ' DELETE ' + name + ' WHERE FMemId IN(SELECT FMemId FROM #Member )'
|
|
|
|
|
FROM sysobjects WHERE name LIKE 'TMember%'
|
|
|
|
|
AND name NOT LIKE 'TMemberCardType%'
|
|
|
|
|
AND name NOT LIKE 'TMemberSale%'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DELETE TMemberMerge WHERE FMemId IN(SELECT FMemId FROM #Member )
|
|
|
|
|
DELETE TMemberMergeDetail WHERE FMemId IN(SELECT FMemId FROM #Member )
|
|
|
|
|
DELETE TMemberOldTransHist WHERE FMemId IN(SELECT FMemId FROM #Member )
|
|
|
|
|
DELETE TMemberCardTransfer WHERE FMemId IN(SELECT FMemId FROM #Member )
|
|
|
|
|
DELETE TMemberEmployee WHERE FMemId IN(SELECT FMemId FROM #Member )
|
|
|
|
|
DELETE TMemberPhoto WHERE FMemId IN(SELECT FMemId FROM #Member )
|
|
|
|
|
DELETE TMemberPointHist WHERE FMemId IN(SELECT FMemId FROM #Member )
|
|
|
|
|
DELETE TMemberProperty WHERE FMemId IN(SELECT FMemId FROM #Member )
|
|
|
|
|
DELETE TMemberRemind WHERE FMemId IN(SELECT FMemId FROM #Member )
|
|
|
|
|
DELETE TMemberRemindLog WHERE FMemId IN(SELECT FMemId FROM #Member )
|
|
|
|
|
DELETE TMemberRepay WHERE FMemId IN(SELECT FMemId FROM #Member )
|
|
|
|
|
DELETE TMemberGoods WHERE FMemId IN(SELECT FMemId FROM #Member )
|
|
|
|
|
DELETE TMemberDepositGoods WHERE FMemId IN(SELECT FMemId FROM #Member )
|
|
|
|
|
DELETE TMember WHERE FMemId IN(SELECT FMemId FROM #Member ) AND FMemId != 0
|
|
|
|
|
AND FMemId NOT IN(SELECT FMemId FROM TConsumeBill)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DELETE TMemberCard WHERE FMemId IN(SELECT FMemId FROM #Member ) AND FMemId != 0 AND FCardId NOT IN(SELECT FCardId FROM TConsumeBill)
|
|
|
|
|
|
|
|
|
|
DELETE TMemberConsultLog WHERE FMemId IN(SELECT FMemId FROM #Member )
|
|
|
|
|
DELETE TMemberExtension WHERE FMemId IN(SELECT FMemId FROM #Member )
|
|
|
|
|
DELETE TMemberReceiveGoods WHERE FMemId IN(SELECT FMemId FROM #Member )
|
|
|
|
|
DELETE TMemberChangeLogIndex WHERE FMemId IN(SELECT FMemId FROM #Member )
|
|
|
|
|
DELETE TMemberCourseHist WHERE FMemId IN(SELECT FMemId FROM #Member )
|
|
|
|
|
DELETE TMemberCourse WHERE FMemId IN(SELECT FMemId FROM #Member )
|
|
|
|
|
DELETE TMemberCourseGoods WHERE FMemId IN(SELECT FMemId FROM #Member )
|
|
|
|
|
DELETE TMemberArrear WHERE FMemId IN(SELECT FMemId FROM #Member )
|
|
|
|
|
DELETE TMemberCourseLog WHERE FMemId IN(SELECT FMemId FROM #Member )
|
|
|
|
|
DELETE TMemberEarnestMoneyLog WHERE FMemId IN(SELECT FMemId FROM #Member )
|
|
|
|
|
DELETE TMemberCoursePack WHERE FMemId IN(SELECT FMemId FROM #Member )
|
|
|
|
|
DELETE TMemberEarnestMoney WHERE FMemId IN(SELECT FMemId FROM #Member )
|
|
|
|
|
DELETE TMemberArrearEmployee WHERE FMemId IN(SELECT FMemId FROM #Member )
|
|
|
|
|
DELETE
|
|
|
|
|
SELECT * FROM TMemberCard WHERE FMemId IN(SELECT FMemId FROM #Member ) AND FMemId > 0
|
|
|
|
|
AND FCardId IN(SELECT FCardId FROM TConsumeBill)
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TConsumeBill WHERE FCardId = 4742465119037545849
|
|
|
|
|
SELECT * FROM TConsumeItemPayment WHERE FBillId = 4907253165795058554
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TC
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DELETE TMemberTransHist WHERE FMemId IN(SELECT FMemId FROM #Member )
|
|
|
|
|
DELETE TMemberImport WHERE FMemId IN(SELECT FMemId FROM #Member )
|
|
|
|
|
DELETE TMemberCardAccount WHERE FMemId IN(SELECT FMemId FROM #Member )
|
|
|
|
|
DELETE TMemberChangeLog WHERE FMemId IN(SELECT FMemId FROM #Member )
|
|
|
|
|
DELETE TMemberTransHistPayment WHERE FMemId IN(SELECT FMemId FROM #Member )
|
|
|
|
|
DELETE TMemberCardAcctHist WHERE FMemId IN(SELECT FMemId FROM #Member )
|
|
|
|
|
DELETE TMemberSMSFee WHERE FMemId IN(SELECT FMemId FROM #Member )
|
|
|
|
|
DELETE TMemberCardMerge WHERE FMemId IN(SELECT FMemId FROM #Member )
|
|
|
|
|
DELETE TMemberCardMergeDetail WHERE FMemId IN(SELECT FMemId FROM #Member )
|
|
|
|
|
DELETE TMemberCardOldAcctHist WHERE FMemId IN(SELECT FMemId FROM #Member )
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TMemberCard WHERE FMemId = 4909915653990741020
|
|
|
|
|
|
|
|
|
|
UPDATE TMember SET FMemNO = FMemNO + '<EFBFBD><EFBFBD>ɾ',FDeleted = 1 WHERE FMemId = 4957414650989364869
|
|
|
|
|
|
|
|
|
|
UPDATE TConsumeBill SET FMemNO = FMemNo + '<EFBFBD><EFBFBD>ɾ' WHERE FMemId = 4957414650989364869
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TMember WHERE FCompId != 6475914903988698362
|
|
|
|
|
and FMEMid IN(SELECT FMemId FROM TMemberTransHist WHERE FCompID != 6475914903988698362)
|
|
|
|
|
|
|
|
|
|
INSERT TMemberCardAccount
|
|
|
|
|
select * from qd186.qingdao_jflying.dbo.TMemberCardAccount WHERE FMemId IN(SELECT FMemId FROM TMember WHERE FCompID != 6475914903988698362)
|
|
|
|
|
|
|
|
|
|
DELETE TMemberCard WHERE FCardId = 4809007858313506024
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TConsumeBill WHERE FMemId = 4909915653990741020
|
|
|
|
|
SELECT * FROM TConsumeItemPayment WHERE FBillId = 4765499720008795963
|
|
|
|
|
|
|
|
|
|
DELETE TMember WHERE FMemId = 4909915653990741020
|
|
|
|
|
UPDATE TConsumeBill SET FMemId = 0 ,FCardId = 0 WHERE FCardId = 4809007858313506024
|
|
|
|
|
|
|
|
|
|
select * from TMemberCardAcctHist WHERE FCardId = 4809007858313506024
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
select * from TCardNoDetail
|
|
|
|
|
|
|
|
|
|
DELETE TCardNoDetail WHERE FCompId != 6475914903988698362
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TItem
|
|
|
|
|
|
|
|
|
|
DELETE TItemSub WHERE FCompID != 6475914903988698362
|
|
|
|
|
|
|
|
|
|
DELETE TItem WHERE FId NOT IN(SELECT FItemId FROM TItemSub)
|
|
|
|
|
AND FId NOT IN(SELECT FItemId FROM TConsumeItem )
|
|
|
|
|
AND FId NOT IN(SELECT FItemId FROM TItemSub)
|
|
|
|
|
|
|
|
|
|
DELETE TGoodsSub WHERE FCompId != 6475914903988698362
|
|
|
|
|
|
|
|
|
|
DELETE TGoods WHERE FId NOT IN(SELECT FGoodsId FROM TGoodsSub)
|
|
|
|
|
|
|
|
|
|
DELETE TInventory WHERE FCompID != 6475914903988698362
|
|
|
|
|
DELETE TInventoryLog WHERE FCompID != 6475914903988698362
|
|
|
|
|
|
|
|
|
|
DELETE TGoodsSub WHERE FId IN(SELECT FId FROM TGoods WHERE FDeleted = 1)
|
|
|
|
|
DELETE TGoods WHERE FDeleted = 1
|
|
|
|
|
|
|
|
|
|
DELETE TMemberCardTypeSub WHERE FCompID != 6475914903988698362
|
|
|
|
|
|
|
|
|
|
DELETE TMemberCardType WHERE FId NOT IN(SELECT FCardTypeID FROM TMemberCardTypeSub)
|
|
|
|
|
AND FId > 9
|
|
|
|
|
AND FId NOT IN(SELECT FTypeId FROM TMemberCard)
|
|
|
|
|
|
|
|
|
|
DELETE TEmployeeSub WHERE FCompID != 6475914903988698362
|
|
|
|
|
DELETE TEmployee WHERE FId NOT IN(SELECT FEmpId FROM TEmployeeSub )
|
|
|
|
|
AND FId > 0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TItem WHERE FId IN(SELECT FItemId FROM TConsumeItem )
|
|
|
|
|
AND FId NOT IN(SELECT FItemId FROM TItemSub)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DELETE TCourse WHERE FItemId NOT IN(SELECT FItemId FROM TItemSub)
|
|
|
|
|
|
|
|
|
|
DELETE TItemSub WHERE FItemId IN(SELECT FId FROM TItem WHERE FDeleted = 1)
|
|
|
|
|
DELETE TCourse WHERE FItemId IN(SELECT FId FROM TItem WHERE FDeleted = 1)
|
|
|
|
|
|
|
|
|
|
DELETE TItem WHERE FDeleted = 1
|
|
|
|
|
|
|
|
|
|
DELETE TItem WHERE
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DELETE TUserAllowCompany WHERE FCompID != 6475914903988698362
|
|
|
|
|
|
|
|
|
|
DELETE TUser WHERE FId NOT IN(SELECT FUserId FROM TUserAllowCompany) AND FId > 10
|
|
|
|
|
DELETE TUserRole WHERE FUserId NOT IN(SELECT FUserId FROM TUserAllowCompany) AND FId > 10
|
|
|
|
|
DELETE TFavoriteFunction WHERE FUserId NOT IN(SELECT FUserId FROM TUserAllowCompany)
|
|
|
|
|
AND FUserId > 10
|
|
|
|
|
|
|
|
|
|
DELETE TSystemParamSub WHERE FCompId != 6475914903988698362
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TSystemParamSub
|
|
|
|
|
|
|
|
|
|
INSERT TSystemParamSub(FCompId,FParamKey,FValue)
|
|
|
|
|
SELECT FCompId,FParamKey,FValue
|
|
|
|
|
FROM qd186.qingdao_jflying.dbo.TSystemParamSub WHERE FCompId =
|
|
|
|
|
6475914903988698362
|
|
|
|
|
|
|
|
|
|
UPDATE A
|
|
|
|
|
SET A.FValue = B.FValue
|
|
|
|
|
FROM TSystemParamSub AS B,TSystemParam AS A
|
|
|
|
|
WHERE A.FKey = B.FParamKey
|
|
|
|
|
|
|
|
|
|
DELETE TSystemParamSub
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
--<EFBFBD>ۿ<EFBFBD>
|
|
|
|
|
DELETE TItemDiscountDetail WHERE FParentId IN(SELECT FId FROM TItemDiscountMid
|
|
|
|
|
WHERE FParentId IN(SELECT FId FROM TItemDiscountMaster WHERE FCompID != 6475914903988698362))
|
|
|
|
|
|
|
|
|
|
DELETE TItemDiscountMid where FParentId IN(SELECT FId FROM TItemDiscountMaster WHERE FCompID != 6475914903988698362)
|
|
|
|
|
|
|
|
|
|
DELETE TItemDiscountMaster WHERE FCompID != 6475914903988698362
|
|
|
|
|
|
|
|
|
|
DELETE TGoodsDiscountDetail where FMasterId IN(SELECT FId FROM TGoodsDiscountMaster WHERE FCompID != 6475914903988698362)
|
|
|
|
|
|
|
|
|
|
DELETE TGoodsDiscountMaster WHERE FCompID != 6475914903988698362
|
|
|
|
|
|
|
|
|
|
--<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SELECT* FROM TBasicDataSyncControl
|
|
|
|
|
|
|
|
|
|
WHERE FCompID = 6475914903988698362
|
|
|
|
|
|
|
|
|
|
DELETE TItemBaseComm WHERE FCompID != 6475914903988698362
|
|
|
|
|
DELETE TGoodsBaseComm WHERE FCompID != 6475914903988698362
|
|
|
|
|
DELETE TMemberCardTypeBaseComm WHERE FCompID != 6475914903988698362
|
|
|
|
|
DELETE TCourseSaleBaseComm WHERE FCompID != 6475914903988698362
|
|
|
|
|
|
|
|
|
|
DELETE TItemCommSchemeMaster WHERE FCompID != 6475914903988698362
|
|
|
|
|
|
|
|
|
|
--<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
DELETE TBasicTypeSub WHERE FCompId != 6475914903988698362
|
|
|
|
|
|
|
|
|
|
DELETE TBasicType WHERE FId > 99999 AND FId NOT IN(SELECT FBasicTypeId FROM TBasicTypeSub )
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SELECT ' IF EXISTS(SELECT * FROM ' + object_name(id) + ' WHERE FCompId != 0 AND FCompId != 6475914903988698362) SELECT ''' + object_name(id) + '''',
|
|
|
|
|
name from syscolumns where name = 'FCompId'
|
|
|
|
|
|
|
|
|
|
--<EFBFBD>Ű<EFBFBD>
|
|
|
|
|
|
|
|
|
|
DELETE TEmployeeSchedule WHERE FEmpID not in(SELECT FId FROM TEmployee)
|
|
|
|
|
DELETE TSchedule WHERE FId NOT IN(SELECT FScheduleID FROM TEmployeeSchedule)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
EXEC PC
|