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.
364 lines
12 KiB
364 lines
12 KiB
use qingdao_shishangfan
|
|
|
|
SELECT * FROM TImp
|
|
|
|
SELECT * FROM TImpMemberCard
|
|
|
|
|
|
--¿¨Àà±ð
|
|
SELECT * FROM TImpCardType
|
|
ALTER TABLE TImpCardType ADD FCardTypeId BIGINT
|
|
ALTER TABLE TImpCardType ADD FCardTypeNo VARCHAR(50)
|
|
ALTER TABLE TImpCardType ADD FCardTypeName VARCHAR(50)
|
|
UPDATE TImpCardType
|
|
SET FCardTypeId = CardCategoryId,
|
|
FCardTypeName = CardCategoryName,
|
|
FCardTypeNo = HotKey
|
|
|
|
sp_rename 'TImpCardType.FId','FCardTypeId'
|
|
|
|
INSERT INTO TMemberCardType(FId,FNo,FName,FValueType,FMaterial,FPrice,FCardFeeAmt,FAcctId,FDeposit,FAcctId2,FDeposit2,FAcctId3,FDeposit3,FTimes,FAlertBalance,FMinRchgAmt,FSalePointMode,FSalePointValue,FRchgPointMode,FRchgPointValue,FPaySmsFee,FTimeCard,FValidityPeriod,FValidityPeriodUnit,FExpiredDate,FDefaultMemo,FCreateTime,FAllowSale,FAllowRchg,FDeptId,FEnabled,FOrder)
|
|
SELECT FId =FCardTypeId, FCardTypeNo,FCardTypeName,1,FMaterial = 2,Price,FCardFeeAmt = 0,FAcctId = 3,FDeposit = StoredValue,FAcctId2 = 0,FDeposit2 = 0 ,FAcctId3 = 0,FDeposit3 = 0,
|
|
FTimes = 0,FAlertBalance = 0,FMinRchgAmt = 0,FSalePointMode = 0,FSalePointValue = 0 ,FRchgPointMode = 0,FRchgPointValue = 0,FPaySmsFee = 0,FTimeCard = 0,FValidityPeriod = 100,FValidityPeriodUnit = 1,
|
|
FExpiredDate = NULL,FDefaultMemo = '',FCreateTime = GETDATE(),1,1,FDeptId = 0,FEnabled =1,FOrder = 1
|
|
FROM TImpCardType
|
|
|
|
|
|
INSERT INTO TMemberCardTypeSub(FId,FCompId,FCardTypeId,FAllowSale,FAllowRchg,FEnabled)
|
|
SELECT dbo.FNNewId(),dbo.FNCompId('001'),I.FCardTypeId,1,1,1
|
|
FROM TImpCardType AS I
|
|
|
|
|
|
SELECT * FROM TImpMember AS A,TImpMemberCard AS B
|
|
WHERE A.FNo = B.FCLientNO
|
|
AND A.FName = ''
|
|
AND FMoney > 0
|
|
|
|
|
|
SELECT * FROM TImpMember
|
|
SELECT * FROM TImpMemberCard
|
|
|
|
SELECT * FROM TImpMemberCard WHERE FClientNO = '0003'
|
|
|
|
|
|
ALTER TABLE TImpMemberCard ADD FCardTypeName VARCHAR(100)
|
|
ALTER TABLE TImpMemberCard ADD FMemId BIGINT
|
|
ALTER TABLE TImpMemberCard ADD FCardNo VARCHAR(50)
|
|
ALTER TABLE TImpMemberCard ADD FCardState INT
|
|
ALTER TABLE TImpMemberCard ADD FCardTypeId BIGINT
|
|
ALTER TABLE TImpMemberCard ADD FBalance DECIMAL(18,6)
|
|
ALTER TABLE TImpMemberCard ADD FBalance2 DECIMAL(18,6)
|
|
ALTER TABLE TImpMemberCard ADD FRemainTimes INT
|
|
ALTER TABLE TImpMemberCard ADD FCreateDate DATETIME
|
|
ALTER TABLE TImpMemberCard ADD FExpiredDate DATETIME
|
|
ALTER TABLE TImpMemberCard ADD FMemo VARCHAR(1000)
|
|
ALTER TABLE TImpMemberCard ADD FCompId BIGINT
|
|
ALTER TABLE TImpMemberCard ADD FCardId BIGINT
|
|
|
|
|
|
ALTER TABLE TImpMember ADD FCompId BIGINT
|
|
ALTER TABLE TImpMember ADD FMemId BIGINT
|
|
ALTER TABLE TImpMember ADD FMemNo VARCHAR(50)
|
|
ALTER TABLE TImpMember ADD FName VARCHAR(50)
|
|
ALTER TABLE TImpMember ADD FGender INT
|
|
ALTER TABLE TImpMember ADD FMobile VARCHAR(50)
|
|
ALTER TABLE TImpMember ADD FMemo VARCHAR(1000)
|
|
ALTER TABLE TImpMember ADD FArrear DECIMAL(18,6)
|
|
ALTER TABLE TImpMember ADD FPoint DECIMAL(18,6)
|
|
ALTER TABLE TImpMember ADD FState INT
|
|
ALTER TABLE TImpMember ADD FCreateDate DATETIME
|
|
ALTER TABLE TImpMember ADD FDeleted BIT
|
|
ALTER TABLE TImpMember ADD FBirthday DATETIME
|
|
ALTER TABLE TImpMember ADD FBirthdayType CHAR
|
|
|
|
|
|
--»áÔ±ID
|
|
UPDATE TImpMember SET FMemId=MemberId
|
|
--¿¨ID
|
|
UPDATE TImpMemberCard SET FCardId=MCID
|
|
|
|
--¿¨»áÔ±ID
|
|
UPDATE A
|
|
SET A.FMemId = B.FMemId
|
|
FROM TImpMember AS B,TImpMemberCard AS A
|
|
WHERE A.MemberShopId = B.MemberShopId
|
|
|
|
--ÊÖ»úºÅÂë,ÐÕÃû,ÐÔ±ð,ÉúÈÕ,»ý·Ö
|
|
UPDATE TImpMember SET FName = TrueName,FMobile = Mobile,FGender = Sex ,
|
|
FBirthdayType = CASE WHEN BirthdayType = 2 THEN 'G' ELSE 'L' END,
|
|
FBirthday = BirthdayText,
|
|
FCreateDate = CreateTime,
|
|
FPoint = WebPoints
|
|
|
|
UPDATE TImpMember SET FBirthday = NULL WHERE FBirthday = '1900-01-01 00:00:00.000'
|
|
|
|
--Ãŵê
|
|
UPDATE TImpMember SET FCompId = 1
|
|
|
|
|
|
--´¢Öµ¿¨ºÅ
|
|
--select * from TImpMemberCard
|
|
UPDATE TImpMemberCard SET FCardNo = MemberCardId
|
|
|
|
--»áÔ±±àºÅ
|
|
UPDATE TImpMember SET FMemNo = ''
|
|
|
|
UPDATE A
|
|
SET A.FMemNo = B.FCardNo
|
|
FROM TImpMember AS A,TImpMemberCard AS B
|
|
WHERE A.FMemId = B.FMemId
|
|
|
|
UPDATE TImpMember SET FMemNO = FMobile WHERE ISNULL(FMemNo,'') = ''
|
|
|
|
--°ÑûÓп¨,ÓÖÖظ´µÄɾµô
|
|
|
|
UPDATE TImpMember SET FDeleted = 0
|
|
UPDATE TImpMember SET FDeleted = 1
|
|
WHERE MemberShopId NOT IN(SELECT MemberShopId FROM TImpMemberCard)
|
|
AND MemberShopId NOT IN(SELECT MemberShopId FROM TImpMemberCourse)
|
|
AND FMemNo IN(
|
|
|
|
SELECT FMemNo
|
|
FROM TImpMember
|
|
WHERE FDeleted = 0
|
|
GROUP BY FMemNo
|
|
HAVING(SUM(1) > 1)
|
|
)
|
|
|
|
|
|
|
|
--¿¨Àà±ð
|
|
UPDATE A
|
|
SET A.FCardTypeID = B.FCarDtYPEiD
|
|
FROM TImpMemberCard AS A,TImpCardType AS B
|
|
WHERE A.MemberCardCategoryName = B.FCardTypeName
|
|
|
|
--״̬
|
|
UPDATE TImpMemberCard SET FCardState = 1 WHERE CardStatusStr = 'Õý³£'
|
|
UPDATE TImpMemberCard SET FCardState = 4 WHERE CardStatusStr = '¶³½á'
|
|
SELECT *FROM TImpMemberCard WHERE CardStatusStr != 'Õý³£'
|
|
|
|
|
|
--Óà¶î
|
|
UPDATE TImpMemberCard SET FBalance =NowAmount,FBalance2 = NowGiveAmount
|
|
|
|
--ÓÐЧÆÚ
|
|
UPDATE TImpMemberCard SET FCreateDate = CreateTimeStr,FExpiredDate = ExpiredDateStr
|
|
|
|
UPDATE TImpMemberCard SET FCompId = 1
|
|
|
|
|
|
--ÁƳÌID
|
|
SELECT * FROM TIMpMemberCourse
|
|
|
|
UPDATE TIMpMemberCourse SET FCardId = MCID
|
|
UPDATE TIMpMemberCourse SET FMemId = MemberId
|
|
UPDATE TIMpMemberCourse SET FCompId= 1
|
|
UPDATE TIMpMemberCourse SET FState = 1 WHERE CardStatusStr = 'Õý³£'
|
|
|
|
|
|
UPDATE TIMpMemberCourse SET FCourseId =
|
|
|
|
SELECT * FROM TImpMember WHERE FMemId = 3710221
|
|
|
|
INSERT INTO TMember(
|
|
FMemId,
|
|
FMemNo,
|
|
FName,
|
|
FBriefCode,
|
|
FTypeId,
|
|
FCompId,
|
|
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 AS FMemId,
|
|
FMemNo AS FMemNo,
|
|
FName AS FName,
|
|
dbo.FNGetFirstPinYin(FName),
|
|
0 AS FTypeId,
|
|
FCompId AS FCompId,
|
|
FCreateDate AS FCreateDate,
|
|
FGender AS FGender,
|
|
FBirthdayType AS FBirthdayType,
|
|
FBirthday AS FBirthday,
|
|
'' AS FTelephone,
|
|
ISNULL(FMobile,'') AS FMobilePhone,
|
|
'' AS FQQ,
|
|
'' AS FWeChat,
|
|
'' AS FIdCard,
|
|
'' AS FEmail,
|
|
'' AS FAddress,
|
|
0 AS FProId,
|
|
'' AS FCPW,
|
|
'' AS FQPW,
|
|
0 AS FChargeEmpId,
|
|
FPoint AS FPoint,
|
|
1 AS FRecvConsSMS,
|
|
1 AS FRecvBulkSMS,
|
|
'' AS FMemo,
|
|
'´ÓÀÏϵͳµ¼Èë' AS FCustom1,'' AS FCustom2,'' AS FCustom3,'' AS FCustom4,'' AS FCustom5
|
|
from TImpMember
|
|
|
|
|
|
SELECT * FROM TMemberCardType
|
|
|
|
UPDATE A SET A.FId = 0 FROM TImpCardType AS A
|
|
|
|
UPDATE A SET A.FId = B.FId FROM TImpCardType AS A,TMemberCardType AS B
|
|
WHERE A.FCardTypeNo = B.FNo
|
|
|
|
UPDATE A
|
|
SET A.FCardTypeId = B.FId
|
|
FROM TImpMemberCard AS A,TImpCardType AS B
|
|
WHERE A.FCardTypeId = B.FCardTypeId
|
|
|
|
UPDATE TImpMemberCard SET FCardTypeId = 4953137442972249707 WHERE FCardTypeId = 4960169439336235374
|
|
|
|
SELECT * FROM TImpCardTyp
|
|
|
|
|
|
|
|
INSERT INTO TMemberCard(
|
|
FCardId,
|
|
FCardNo,
|
|
|
|
FTypeId,
|
|
FValueType,
|
|
FCompId,
|
|
FMemId,
|
|
FState,
|
|
FCreateDate,
|
|
FExpiredDate,
|
|
FTotalTimes,
|
|
FUsedTimes,
|
|
FSaleCompId,
|
|
FSaleBillId,
|
|
FMemo)
|
|
SELECT
|
|
FCardId AS FId,
|
|
FCardNo AS FNo,
|
|
FCardTypeId AS FTypeId,
|
|
(SELECT FValueType FROM TMemberCardType WHERE FId = FCardTypeId) AS FValueType,
|
|
FCompId AS FCompId,
|
|
FMemId AS FMemId,
|
|
FCardState AS FState,
|
|
FCreateDate AS FCreateDate,
|
|
FExpiredDate AS FExpiredDate,
|
|
0 AS FTotalTimes,
|
|
0 AS FUsedTimes,
|
|
FCompId AS FSaleCompId,
|
|
0 AS FSaleBillId,
|
|
ISNULL(FMemo,'') AS FMemo
|
|
FROM TImpMemberCard
|
|
|
|
|
|
INSERT TMemberCardAccount(FMemId,FId,FCardId,FAcctId,FDeposit,FBalance,FArrear,FCreateDate,FExpiredDate,FMemo)
|
|
SELECT FMemId,dbo.FNNewId(),FCardId AS FCardId,3,FBalance,FBalance,0,FCreateDate,NULL AS FExpiredDate,''
|
|
FROM TImpMemberCard AS A
|
|
|
|
|
|
INSERT TMemberCardAcctHist(FId,FMemId,FCardId,FAcctId,FTime,FCardTypeId,FCompId,FBillType,FBizType,FTransId,FTransNo,FInAmount,FOutAmount,FBalance,FArrear,FRecordTime,FMemo)
|
|
select dbo.FNNewId(),A.FMemId,A.FCardId,3,getdate(),A.FCardTypeId,A.FCompId,'DR','Import',0,'',A.FBalance,0,A.FBalance,0,getdate(),'´ÓÐÇɳÁúÖе¼Èë'
|
|
FROM TImpMemberCard AS A
|
|
|
|
|
|
|
|
INSERT TMemberCardAccount(FMemId,FId,FCardId,FAcctId,FDeposit,FBalance,FArrear,FCreateDate,FExpiredDate,FMemo)
|
|
SELECT FMemId,dbo.FNNewId(),FCardId AS FCardId,10,FBalance2,FBalance2,0,FCreateDate,NULL AS FExpiredDate,''
|
|
FROM TImpMemberCard AS A
|
|
WHERE FBalance2 != 0
|
|
|
|
INSERT TMemberCardAcctHist(FId,FMemId,FCardId,FAcctId,FTime,FCardTypeId,FCompId,FBillType,FBizType,FTransId,FTransNo,FInAmount,FOutAmount,FBalance,FArrear,FRecordTime,FMemo)
|
|
select dbo.FNNewId(),A.FMemId,A.FCardId,10,getdate(),A.FCardTypeId,A.FCompId,'DR','Import',0,'',A.FBalance2,0,A.FBalance2,0,getdate(),'´ÓÐÇɳÁúÖе¼Èë'
|
|
FROM TImpMemberCard AS A
|
|
WHERE FBalance2 != 0
|
|
|
|
|
|
|
|
--ÁƳÌ
|
|
SELECT * FROM TIMpMemberCourse
|
|
SELECT * FROM TImpMemberCourseDetail
|
|
ALTER TABLE TIMpMemberCourse ADD FMemId BIGINT
|
|
|
|
ALTER TABLE TIMpMemberCourseDetail ADD FPurTimes INT
|
|
ALTER TABLE TIMpMemberCourseDetail ADD FUsedPurTimes INT
|
|
ALTER TABLE TIMpMemberCourseDetail ADD FPurAmount DECIMAL(18,6)
|
|
ALTER TABLE TIMpMemberCourseDetail ADD FItemId BIGINT
|
|
ALTER TABLE TIMpMemberCourseDetail ADD FCourseId BIGINT
|
|
ALTER TABLE TIMpMemberCourseDetail ADD FCreateDate DATETIME
|
|
ALTER TABLE TIMpMemberCourseDetail ADD FExpiredDate DATETIME
|
|
ALTER TABLE TIMpMemberCourseDetail ADD FCompId BIGINT
|
|
ALTER TABLE TIMpMemberCourseDetail ADD FMemId BIGINT
|
|
ALTER TABLE TIMpMemberCourseDetail ADD FCardId BIGINT
|
|
|
|
UPDATE TImpMemberCourse SET FMemId = MemberId
|
|
|
|
UPDATE A
|
|
SET A.FMemId = B.FMemId
|
|
FROM TImpMemberCourseDetail AS A,TImpMemberCourse AS B
|
|
WHERE A.MCID = B.MCID
|
|
|
|
|
|
UPDATE TImpMemberCourseDetail SET FCardId = MCID
|
|
UPDATE TImpMemberCourseDetail SET FCompId = 1
|
|
UPDATE TImpMemberCourseDetail SET FCourseId = 4854799989982317296
|
|
UPDATE TImpMemberCourseDetail SET FItemid = 5364344419216701040
|
|
UPDATE TImpMemberCourseDetail SET FCreateDate = CreateTimeStr
|
|
UPDATE TImpMemberCourseDetail SET FExpiredDate = ExpiredDateStr
|
|
|
|
|
|
INSERT TMemberCourse(FId,FMemId,FCourseId,FMemPackId,FItemId,FCompId,FPurTimes,FUsedPurTimes,FPurAmount,FFreeTimes,FFreeAmount,FPurchaseDate,FExpiredDate,FBizType,FTransId,FArrear,FDurable,FMemo,FCalcMode,FAdjustPrice)
|
|
SELECT FCardId,FMemId,FCourseId,0,FItemId,FCompId,ConsumeTimes + 0 + Times + 0,ConsumeTimes,0,0,0,FCreateDate,FExpiredDate,'DR.Import',0,0,0,'ÐÂɳÁúµ¼Èë',1,0
|
|
FROM TImpMemberCourseDetail AS A
|
|
|
|
|
|
INSERT INTO TMemberCourseLog(FId,FMemId,FCardId,FPackId,FCourseId,FTime,FInPurTimes,FInFreeTimes,FOutPurTimes,FOutFreeTimes,FCompId,FBillType,FBizType,FBillId,FBillNo,FBillDetailId,FRecordTime)
|
|
SELECT dbo.FNNewId(),FMemId,A.FCardId AS FCardId,0, ISNULL(FCourseId,0),getdate(),ConsumeTimes + 0 + Times + 0,0,ConsumeTimes,0,FCompId,'DR','Import',0,'',0,getdate()
|
|
FROM TImpMemberCourseDetail AS A
|
|
|
|
DELETE TMemberCourseLog WHERE FCardId IN(SELECT FCardId FROM TImpMemberCourseDetail)
|
|
DELETE TMemberCourse WHERE FId IN(SELECT FCardId FROM TImpMemberCourseDetail)
|
|
|
|
SELECT * FROM TCourse
|
|
|
|
DROP TABLE TIMpMemberCourse
|
|
|
|
ALTER TABLE TImpMemberTransHistDetail ADD
|
|
|
|
|
|
--½ÌÓýÀúÊ·
|
|
ALTER TABLE TImpMemberTransHist ADD FCompId BIGINT
|
|
UPDATE TImpMemberTransHist SET FCompID = 1
|
|
|
|
INSERT TMemberOldTransHist(FId,FMemId,FTime,FCardId,FCompId,FBillType,FBizType,FTransNo,FContent,FPrice,FQuantity,FAmount,FPayment,FEmployee,FMemo)
|
|
SELECT dbo.FNNewId(),A.MemberId,A.CreateTimeStr,0,A.FCompId,'DR','Import',ConsumeBillNo,ContentStr,0,1,0,Payments,EmployeeNames,''
|
|
FROM TImpMemberTransHist AS A ,TImpMemberTransHistDetail AS B
|
|
WHERE A.Id = B.Id
|
|
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TImpMemberTransHist where id = 4911593833057529541
|
|
SELECT * FROM TImpMemberTransHistDetail
|
|
|
|
|
|
DROP TABLE TImpMemberTransHist
|
|
DROP TABLE TImpMemberTransHistDetail
|
|
|
|
SELECT Id FROM TImpMemberTransHistDetail GROUP BY ID HAVING(SUM(1) > 1)
|
|
|
|
SELECT * FROM TMember WHERE FMemId=
|
|
3709596
|
|
1006684
|
|
|
|
/**
|
|
м´ÐË 13854209915,123456
|
|
|
|
Ò»Ôó 18669871559", 123456
|
|
|
|
ʱÉз¶ 15726228884 ssf12345678
|
|
|
|
*/ |