在微信数据管理器中,执行下列脚本,注意填写好门店编号。
SET XACT_ABORT on
Begin Transaction
Declare @ShopCode bigint
Set @ShopCode = 103/*填写要保留的门店编号*/
Delete ASM_CounterBill Where ShopCode <> @ShopCode
Delete ASM_MaintenanceBill Where ShopCode <> @ShopCode
Delete ASM_NumberBill Where ShopCode <> @ShopCode
Delete ASM_NumberBillDetail Where ShopCode <> @ShopCode
Delete ASM_NumberBillWaste Where ShopCode <> @ShopCode
Delete CRM_BonusPointsExchangeBill Where ShopCode <> @ShopCode
Delete CRM_Customer Where ShopCode <> @ShopCode and IsShare = '0'
Delete CRM_FeedbackBill Where ShopCode <> @ShopCode
Delete CRM_IndividualCustomer Where ShopCode <> @ShopCode and (Select IsShare From CRM_Customer Where CRM_Customer.Code = CRM_IndividualCustomer.Code)='0'
Delete CRM_Linkman Where ShopCode <> @ShopCode
Delete CRM_NegotiatedPrice Where ShopCode <> @ShopCode
Delete CRM_OrganCustomer Where ShopCode <> @ShopCode and (Select IsShare From CRM_Customer Where CRM_Customer.Code = CRM_OrganCustomer.Code)='0'
Delete CRM_ProjectCustomer Where ShopCode <> @ShopCode and (Select IsShare From CRM_Customer Where CRM_Customer.Code = CRM_ProjectCustomer.Code)='0'
Delete FAM_Account Where ShopCode <> @ShopCode
Delete FAM_AccountHistory Where ShopCode <> @ShopCode
Delete FAM_AccPCalendar Where ShopCode <> @ShopCode
Delete FAM_CredenceBill Where ShopCode <> @ShopCode
Delete FAM_CredenceBillDetail Where ShopCode <> @ShopCode
Delete FAM_IncomingBill Where ShopCode <> @ShopCode
Delete FAM_OutgoingBill Where ShopCode <> @ShopCode
Delete FAM_TransferBill Where ShopCode <> @ShopCode
Update GSS_EMSDB Set ShopCode = Convert(nvarchar(100),@ShopCode) Where Code = '000000'
Delete HRM_AttendenceBill Where ShopCode <> @ShopCode
Delete HRM_AttendenceBillDetail Where ShopCode <> @ShopCode
Delete HRM_PunishBill Where ShopCode <> @ShopCode
Delete HRM_PunishBillDetail Where ShopCode <> @ShopCode
Delete HRM_RewardBill Where ShopCode <> @ShopCode
Delete HRM_RewardBillDetail Where ShopCode <> @ShopCode
Delete INM_AntiInBill Where ShopCode <> @ShopCode
Delete INM_AntiInBillDetail Where ShopCode <> @ShopCode
Delete INM_CheckBill Where ShopCode <> @ShopCode
Delete INM_CheckBillDetail Where ShopCode <> @ShopCode
Delete INM_InBill Where ShopCode <> @ShopCode
Delete INM_InBillDetail Where ShopCode <> @ShopCode
Delete INM_MaterialStock Where ShopCode <> @ShopCode
Delete INM_MoveBill Where ShopCode <> @ShopCode
Delete INM_MoveBillDetail Where ShopCode <> @ShopCode
Delete INM_OutBill Where ShopCode <> @ShopCode
Delete INM_OutBillDetail Where ShopCode <> @ShopCode
Delete INM_PackagingBill Where ShopCode <> @ShopCode
Delete INM_PackagingBillDetail Where ShopCode <> @ShopCode
Delete INM_PlanBill Where ShopCode <> @ShopCode
Delete INM_PlanBillDetail Where ShopCode <> @ShopCode
Delete INM_UsedBill Where ShopCode <> @ShopCode
Delete INM_UsedBillDetail Where ShopCode <> @ShopCode
Delete PIM_Logy Where ShopCode <> @ShopCode
Delete PIM_Mission Where ShopCode <> @ShopCode
Delete PPM_JobBill Where ShopCode <> @ShopCode
Delete PPM_JobBillDetail Where ShopCode <> @ShopCode
Delete PPM_JobBillDetailNumericAssert Where ShopCode <> @ShopCode
Delete PPM_JobBillDetailUsedMaterial Where ShopCode <> @ShopCode
Delete PPM_JobBillDetailUserExec Where ShopCode <> @ShopCode
Delete PPM_LogisticsBill Where ShopCode <> @ShopCode
Delete PPM_OutSourcingBill Where ShopCode <> @ShopCode
Delete PPM_ProblemBill Where ShopCode <> @ShopCode
Delete PPM_ProduceSendAndGet Where ShopCode <> @ShopCode
Delete PPM_ProduceTakeOver Where ShopCode <> @ShopCode
Delete PPM_UserAssign Where ShopCode <> @ShopCode
Delete RSM_CashGatheringBill Where ShopCode <> @ShopCode
Delete RSM_ChargeUpGatheringBill Where ShopCode <> @ShopCode
Delete RSM_PettyGatheringBill Where ShopCode <> @ShopCode
Delete RSM_PreGatheringBill Where ShopCode <> @ShopCode
Delete RSM_RefundmentBill Where ShopCode <> @ShopCode
Delete RSM_SettleGatheringBill Where ShopCode <> @ShopCode
Delete RSM_SettleGatheringBillDetail Where ShopCode <> @ShopCode
Delete SRM_CashPaymentBill Where ShopCode <> @ShopCode
Delete SRM_ChargeUpPaymentBill Where ShopCode <> @ShopCode
Delete SRM_PrePaymentBill Where ShopCode <> @ShopCode
Delete SRM_SettlePaymentBill Where ShopCode <> @ShopCode
Delete SRM_SettlePaymentBillDetail Where ShopCode <> @ShopCode
Delete SRM_Supplier Where ShopCode <> @ShopCode
Delete SYS_SyncPushToShop
Delete SYS_SyncRequestFromShop
COmmit
SET XACT_ABORT off