You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
sql-tools/傅军转研色.sql

180 lines
9.2 KiB

1 year ago
INSERT QingDao_YanSe..TMemberCardType(FId,FNo,FName,FValueType,FMaterial,FPrice,FAcctId,FDeposit,FAcctId2,FDeposit2,FAcctId3,FDeposit3,FTimes,FAlertBalance,FMinRchgAmt,FValidityPeriod,FValidityPeriodUnit,FAllowSale,FAllowRchg,FEnabled,FOrder,FSalePointMode,FSalePointValue,FRchgPointMode,FRchgPointValue)
SELECT dbo.FNBKId('FJ' + FNo),'FJ' + FNo,'FJ' + FName,FValueType,FMaterial,FPrice,FAcctId,FDeposit,FAcctId2,FDeposit2,FAcctId3,FDeposit3,FTimes,FAlertBalance,FMinRchgAmt,FValidityPeriod,FValidityPeriodUnit,FAllowSale,FAllowRchg,1,1,FSalePointMode,FSalePointValue,FRchgPointMode,FRchgPointValue
FROM TMemberCardType
WHERE FId IN
(
SELECT FTypeId FROM TMemberCard WHERE FCompId = 3472333586818924544
)
SELECT * FROM TCOnsumeBill WHERE FCompId != 5470038762445741249
SELECT * FROM TMemberSaleBill WHERE FCompId != 5470038762445741249
SELECT * FROM TLoginSession WHERE FCompId = 4703976043136837438
SELECT * FROM TCompany WHERE FId = 4703976043136837438
USE QingDao_YanSe
GO
PChangeCenterCompany '000'
SELECT * FROM TCompany
UPDATE TCompany SET FIsCenter = 1 WHERE FId = 1
SELECT * FROM TItemSub
SELECT * FROM TBasicDataChanges
SELECT * FROM TEmployeeSub
SELECT *INTO #Employee FROM QingDao_FuJun..TEmployee
WHERE FId IN(SELECT FEmpId FROM QingDao_FuJun..TEmployeeSub WHERE FCompId = 3472333586818924544)
UPDATE #Employee
SET FDeleted = 0
SELECT * FROM TEmployee
INSERT TEmployee( FId,FNo,FName,FEnLname,FEnFname,FNickname,FDeptId,FPosId,FTechTypeId,FBriefCode,FGender,FStature,FWeight,FNationPlace,FNation,FEducation,FMarital,FAddress,FTelephone,FMobilePhone,FQQ,FEmail,FIdCard,FBirthdayType,FBirthday,FCardNo,FCardPW,FPW,FBank,FBankCardNo,FSSNo,FHCNo,FLinkMan,FLinkManTel,FLinkManAddr,FIntroducer,FAllowSign,FAllowBooking,FContractType,FState,FCreatorId,FCreateDate,FEntryDate,FExpiredDate,FLeaveDate,FDescription,FCustom1,FCustom2,FCustom3)
SELECT FId,FNo,FName,FEnLname,FEnFname,FNickname,FDeptId,FPosId,FTechTypeId,FBriefCode,FGender,FStature,FWeight,FNationPlace,FNation,FEducation,FMarital,FAddress,FTelephone,FMobilePhone,FQQ,FEmail,FIdCard,FBirthdayType,FBirthday,FCardNo,FCardPW,FPW,FBank,FBankCardNo,FSSNo,FHCNo,FLinkMan,FLinkManTel,FLinkManAddr,FIntroducer,FAllowSign,FAllowBooking,FContractType,FState,FCreatorId,FCreateDate,FEntryDate,FExpiredDate,FLeaveDate,FDescription,FCustom1,FCustom2,FCustom3
FROM #Employee
UPDATE TEmployee SET FNo = REPLACE(FNo,'<EFBFBD><EFBFBD>ɾ','')
SELECT * FROM TEmployee WHERE FDeleted = 1
AND FNo IN(SELECT FNo FROM TEmployee)
SELECT * FROM QingDao_FuJun..TGoods
SELECT * FROM TEmployee WHERE FNo = '202'
SELECT * FROM TCompany
INSERT TGoods(FId,FNo,FName,FNoOfPad,FTypeId,FBriefCode,FUnitId,FSalePrice,FPurCostPrice,FSaleCostPrice,FConsCostPrice,FValuationMode,FBarCode,FEnabled,FSpecification,FPurUnitId,FConsUnitId,FSupplierId,FStoreId,FConsStoreId,FSaleStoreId,FMaxStock,FMinStock,FPeriodEnabled,FShelfLife,FDctId,FPointMode,FPointValue,FDeptId,FIsSale,FUnitLock,FDescription,FCustom1,FCustom2,FCustom3)
SELECT FId,'FJ' + FNo,FName,'FJ' + FNoOfPad,FTypeId,FBriefCode,FUnitId,FSalePrice,FPurCostPrice,FSaleCostPrice,FConsCostPrice,FValuationMode,FBarCode,FEnabled,FSpecification,FPurUnitId,FConsUnitId,FSupplierId,FStoreId,FConsStoreId,FSaleStoreId,FMaxStock,FMinStock,FPeriodEnabled,FShelfLife,FDctId,FPointMode,FPointValue,FDeptId,FIsSale,FUnitLock,FDescription,FCustom1,FCustom2,FCustom3
FROM QingDao_FuJun..TGoods
SELECT * FROM QingDao_FuJun..TBasicType WHERE FId = 6319267303866303213
UPDATE TEmployee SET FDeptId = 8915050040982620776 WHERE FDeptId = 6319267303866303213
SELECT * FROM TBasicType
WHERE FkEY = 'Department'
USE QingDao_FuJun
GO
DELETE QingDao_YanSe..TMember WHERE FCompId = 5513724865163257401
DELETE QingDao_YanSe..TMemberCard WHERE FCompId = 5513724865163257401
DELETE QingDao_YanSe..TMemberCardAcctHist WHERE FCompId = 5513724865163257401
DELETE QingDao_YanSe..TMemberCardOldAcctHist WHERE FCompId = 5513724865163257401
DELETE QingDao_YanSe..TMemberOldTransHist WHERE FCompId = 5513724865163257401
DELETE QingDao_YanSe..TMemberCardAccount WHERE FCardId IN(SELECT FCardId FROM QingDao_YanSe..TMemberCard WHERE FCompId = 5513724865163257401)
SELECT * FROM QingDao_YanSe..TCompany
INSERT QingDao_YanSe..TMember(FMemId,FMemNo,FName,FBriefCode,FCompId,FTypeId,FIsVisitor,FCreateDate,FGender,FBirthdayType,FBirthday,FTelephone,FMobilePhone,FQQ,FWeChat,FIdCard,FEmail,FAddress,FProId,FCPW,FQPW,FChargeEmpId,FPoint,FRecvConsSMS,FRecvBulkSMS,FMemo,FCustom1,FCustom2,FCustom3,FCustom4,FCustom5)
SELECT FMemId,FMemNo,FName,FBriefCode,5513724865163257401,FTypeId,FIsVisitor,FCreateDate,FGender,FBirthdayType,FBirthday,FTelephone,FMobilePhone,FQQ,FWeChat,FIdCard,FEmail,FAddress,FProId,FCPW,FQPW,FChargeEmpId,FPoint,FRecvConsSMS,FRecvBulkSMS,FMemo,FCustom1,FCustom2,FCustom3,FCustom4,FCustom5
FROM TMember WHERE FCompId = 3472333586818924544
INSERT QingDao_YanSe..TMemberCard(FCardId,FCardNo,FCardFaceNo,FTypeId,FValueType,FCompId,FMemId,FState,FCreateDate,FExpiredDate,FTotalTimes,FUsedTimes,FSaleCompId,FSaleBillId,FMemo)
SELECT FCardId,FCardNo,FCardFaceNo,FTypeId,FValueType,5513724865163257401,FMemId,FState,FCreateDate,FExpiredDate,FTotalTimes,FUsedTimes,FSaleCompId,FSaleBillId,FMemo
FROM #Card
INSERT QingDao_YanSe..TMemberCardAccount(FId,FCardId,FAcctId,FBalance,FArrear,FCreateDate,FExpiredDate,FMemo)
SELECT FId,FCardId,FAcctId,FBalance,FArrear,FCreateDate,FExpiredDate,FMemo FROM TMemberCardAccount WHERE FCardId IN (SELECT FCardId FROM #Card)
INSERT QingDao_YanSe..TMemberCourse(FId,FMemId,FCourseId,FMemPackId,FItemId,FCompId,FPurTimes,FUsedPurTimes, FPurAmount,FFreeTimes,FUsedFreeTimes,FPurchaseDate,FExpiredDate,FBizType,FTransId,FArrear,FDurable,FMemo,FCalcMode,FAdjustPrice)
SELECT FId,FMemId,ISNULL(FCourseId,0),FMemPackId,ISNULL(FItemId,0),5513724865163257401,FPurTimes,FUsedPurTimes, FPurAmount,FFreeTimes,FUsedFreeTimes,FPurchaseDate,FExpiredDate,FBizType,FTransId,FArrear,FDurable,FMemo,FCalcMode,0
FROM TMemberCourse WHERE FCompId = 3472333586818924544
INSERT QingDao_YanSe..TItem(FId,FNo,FNoOfPad,FName,FAbbr,FTypeId,FBriefCode,FDescription,FPriceMode,FIsService,FReturnInterval,FCustom1,FCustom2,FCustom3,FEnabled,FPrice,FVipPrice,FTime,FDctId,FPointMode,FPointValue,FDeptId,FAllowBooking)
SELECT FId,FNo,FNoOfPad,FName,FAbbr,FTypeId,FBriefCode,FDescription,FPriceMode,FIsService,FReturnInterval,FCustom1,FCustom2,FCustom3,FEnabled,FPrice,FVipPrice,FTime,FDctId,FPointMode,FPointValue,FDeptId,FAllowBooking
FROM #Item
INSERT QingDao_YanSe..TCourse(FId,FNo,FName,FBriefCode,FItemId,FPackId,FSequence,FTypeId,FTimes,FFreeTimes,FDurable,FValidityPeriodUnit,FValidityPeriod,FCreateDate,FExpiredDate,FDescription,FEnabled,FPrice,FAmount,FCalcMode)
SELECT FId,FNo,FName,FBriefCode,FItemId,FPackId,FSequence,FTypeId,FTimes,FFreeTimes,FDurable,FValidityPeriodUnit,FValidityPeriod,FCreateDate,FExpiredDate,FDescription,FEnabled,FPrice,FAmount,FCalcMode
FROM #Course
INSERT QingDao_YanSe..TMemberArrear(FId,FMemId,FTime,FCompId,FContentType,FCardId,FBillType,FBizType,FTransId,FTransNo,FTransDetailId,FContentId,FArrear,FEmpId,FRepaid)
SELECT FId,FMemId,FTime,5513724865163257401,FContentType,FCardId,FBillType,FBizType,FTransId,FTransNo,FTransDetailId,FContentId,FArrear,FEmpId,FRepaid
FROM TMemberArrear
WHERE FCompId = 3472333586818924544
SELECT * INTO #Item FROM TItem WHERE FId IN(SELECT FItemId FROM #Course)
UPDATE #Item SET FNo = FNo + '.' + '002',FNoOfPad = FNoOfPad + '.' + '002'
SELECT * FROM #Course
UPDATE #Course SET FNo = REPLACE(FNo,'L1','.002L1');
SELECT *INTO #Course FROM TCourse WHERE FId IN(
SELECT FCourseId FROM TMemberCourse WHERE FCompId = 3472333586818924544)
INSERT QingDao_YanSe..TMemberOldTransHist
SELECT * FROM TMemberOldTransHist
WHERE FCardId IN(SELECT FCardId FROM #Card)
INSERT QingDao_YanSe..TMemberCardAcctHist
SELECT * FROM TMemberCardAcctHist
WHERE FCardId IN(SELECT FCardId FROM #Card)
INSERT QingDao_YanSe..TMemberCardOldAcctHist
SELECT * FROM TMemberCardOldAcctHist
WHERE FCardId IN(SELECT FCardId FROM #Card)
DELETE QingDao_YanSe..TMemberCardAcctHist WHERE FId IN(SELECT FId FROM TMemberCardAcctHist)
drop table #Card
SELECT *INTO #Card FROM TMemberCard WHERE FCompId = 3472333586818924544
UPDATE A
SET A.FTypeId = dbo.FNBKId('FJ' + B.FNo)
FROM #Card AS A,TMemberCardType AS B
WHERE A.FTypeId = B.FId
SELECT * FROM TCompany
UPDATE TMemberOldTranshist SET FCompId = 5513724865163257401
WHERE FCompId = 3472333586818924544
UPDATE TMemberCardOldAccthist SET FCompId = 5513724865163257401
WHERE FCompId = 3472333586818924544
UPDATE TMemberCardAcctHist SET FCompId = 5513724865163257401
WHERE FCompId = 3472333586818924544
DELETE TMemberCardAcctHist
WHERE FCompId = 3472333586818924544
DELETE TMemberCardOldAccthist
WHERE FCompId = 3472333586818924544
DELETE TMemberOldTranshist
WHERE FCompId = 3472333586818924544
DELETE TMemberCardAccount WHERE FCardId IN(SELECT FCardId FROM TMemberCard WHERE FComPid = 3472333586818924544)
DELETE TMemberCard WHERE FComPid = 3472333586818924544
DELETE TMember WHERE FComPid = 3472333586818924544
DELETE TMemberCourse WHERE FComPid = 3472333586818924544
DELETE TMemberArrear WHERE FComPid = 3472333586818924544
SELECT * FROM TMember
WHERE FCompId = 5513724865163257401
SELECT * FROM TMember WHERE FMemID IN(SELECT FMemId FROM TMemberArrear WHERE FCompId = 5513724865163257401)
SELECT * FROM TMemberCourse WHERE FCompId = 5513724865163257401