|
|
|
|
|
|
|
|
|
use KunMing_DingSi
|
|
|
|
|
use lijiang_weimeisisong
|
|
|
|
|
|
|
|
|
|
SELECT * FROM imp_member WHERE FMobile = '13097447666'
|
|
|
|
|
|
|
|
|
|
SELECT * FROM imp_member_1 WHERE FMobile = '13097447666'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SELECT count(1) FROM imp_member_card
|
|
|
|
|
|
|
|
|
|
SELECT * FROM imp_member_card_1 WHERE <EFBFBD><EFBFBD>Ա<EFBFBD><EFBFBD><EFBFBD><EFBFBD> ='13097447666'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
delete imp_member
|
|
|
|
|
|
|
|
|
|
--ɾ<EFBFBD><EFBFBD><EFBFBD>ർ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ظ<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
SELECT <EFBFBD><EFBFBD>Ա<EFBFBD><EFBFBD><EFBFBD><EFBFBD>,SUM(1)
|
|
|
|
|
FROM imp_member
|
|
|
|
|
GROUP BY <EFBFBD><EFBFBD>Ա<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
HAVING SUM(1) > 1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SELECT COUNT(1) FROM imp_member WHERE <EFBFBD>Ǽ<EFBFBD><EFBFBD>ŵ<EFBFBD> = 6161
|
|
|
|
|
|
|
|
|
|
ALTER TABLE imp_member ADD FIndex INT IDENTITY(1,1)
|
|
|
|
|
|
|
|
|
|
SELECT * FROM imp_member
|
|
|
|
|
|
|
|
|
|
SELECT SUM(CAST(<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> AS FLOAT))
|
|
|
|
|
FROM imp_member
|
|
|
|
|
|
|
|
|
|
select count(1) from imp_member WHERE isnull (<EFBFBD><EFBFBD>,'') =''
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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D><EFBFBD><EFBFBD><EFBFBD>)
|
|
|
|
|
SELECT <EFBFBD><EFBFBD>Ա<EFBFBD><EFBFBD><EFBFBD><EFBFBD>,<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> FROM imp_member WHERE ISNULL(<EFBFBD><EFBFBD>,'') = ''
|
|
|
|
|
AND <EFBFBD><EFBFBD>Ա<EFBFBD><EFBFBD><EFBFBD><EFBFBD> NOT IN(SELECT <EFBFBD><EFBFBD>Ա<EFBFBD><EFBFBD><EFBFBD><EFBFBD> FROM imp_member_card)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ALTER TABLE imp_member_card ADD FCardKind VARCHAR(100)
|
|
|
|
|
|
|
|
|
|
UPDATE imp_member_card SET FCardKind = 'Money'
|
|
|
|
|
WHERE (<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> NOT LIKE '%<EFBFBD><EFBFBD>%' AND <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> NOT LIKE '%<EFBFBD><EFBFBD>%' AND <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> LIKE '%Ԫ%')
|
|
|
|
|
OR (<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> NOT LIKE '%<EFBFBD><EFBFBD>%' AND <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> NOT LIKE '%<EFBFBD><EFBFBD>%' AND <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> NOT LIKE '%Ԫ%')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UPDATE imp_member_card SET FCardKind = 'Course' WHERE FCardKind IS NULL
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 =dbo.FNNewId(), FCardTypeName,FCardTypeName,1,FMaterial = 2,0,FCardFeeAmt = 0,FAcctId = 3,FDeposit = 0,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 (
|
|
|
|
|
SELECT <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> AS FCardTypeName FROM imp_member_card
|
|
|
|
|
WHERE FCardKind = 'Money'
|
|
|
|
|
) AS A
|
|
|
|
|
WHERE FCardTypeName NOT IN(SELECT FNo FROM TMemberCardType)
|
|
|
|
|
GROUP BY FCardTypeName
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
INSERT INTO TMemberCardTypeSub(FId,FCompId,FCardTypeId,FAllowSale,FAllowRchg,FEnabled)
|
|
|
|
|
SELECT dbo.FNNewId(),C.FId,I.FId,FAllowSale,FAllowRchg,FEnabled
|
|
|
|
|
FROM TMemberCardType AS I,TCompany AS C
|
|
|
|
|
WHERE I.FId > 1
|
|
|
|
|
AND C.FId != 0
|
|
|
|
|
-- AND C.FNo = '009'
|
|
|
|
|
AND NOT EXISTS(SELECT TOP 1 1 FROM TMemberCardTypeSub AS B WHERE B.FCompId = C.FId AND B.FCardTypeId = I.FId)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
INSERT INTO TMemberCardTypeSub(FId,FCompId,FCardTypeId,FAllowSale,FAllowRchg,FEnabled)
|
|
|
|
|
SELECT FId,dbo.FNCompId('001'),I.FId,1,1,1
|
|
|
|
|
FROM TMemberCardType AS I
|
|
|
|
|
WHERE FId NOT IN(SELECT FCardTypeId FROM TMemberCardTypeSub)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ALTER TABLE imp_member ADD FCardTypeName VARCHAR(100)
|
|
|
|
|
ALTER TABLE imp_member ADD FMemId BIGINT
|
|
|
|
|
ALTER TABLE imp_member ADD FMemNo VARCHAR(50)
|
|
|
|
|
ALTER TABLE imp_member ADD FCardNo VARCHAR(50)
|
|
|
|
|
ALTER TABLE imp_member ADD FName VARCHAR(50)
|
|
|
|
|
ALTER TABLE imp_member ADD FGender INT
|
|
|
|
|
ALTER TABLE imp_member ADD FCardState INT
|
|
|
|
|
ALTER TABLE imp_member ADD FMobile VARCHAR(50)
|
|
|
|
|
ALTER TABLE imp_member ADD FCardTypeId BIGINT
|
|
|
|
|
ALTER TABLE imp_member ADD FCourseId BIGINT
|
|
|
|
|
ALTER TABLE imp_member ADD FBalance DECIMAL(18,6)
|
|
|
|
|
ALTER TABLE imp_member ADD FBalance2 DECIMAL(18,6)
|
|
|
|
|
ALTER TABLE imp_member ADD FRemainTimes INT
|
|
|
|
|
ALTER TABLE imp_member ADD FPurTimes INT
|
|
|
|
|
ALTER TABLE imp_member ADD FPurAmount DECIMAL(18,6)
|
|
|
|
|
ALTER TABLE imp_member ADD FItemId BIGINT
|
|
|
|
|
ALTER TABLE imp_member ADD FCreateDate DATETIME
|
|
|
|
|
ALTER TABLE imp_member ADD FExpiredDate DATETIME
|
|
|
|
|
ALTER TABLE imp_member ADD FCompId BIGINT
|
|
|
|
|
ALTER TABLE imp_member ADD FCardId BIGINT
|
|
|
|
|
ALTER TABLE imp_member ADD FMemo VARCHAR(1000)
|
|
|
|
|
ALTER TABLE imp_member ADD FArrear DECIMAL(18,6)
|
|
|
|
|
ALTER TABLE imp_member ADD FPoint DECIMAL(18,6)
|
|
|
|
|
ALTER TABLE imp_member ADD FState INT
|
|
|
|
|
ALTER TABLE imp_member ADD FDeleted BIT
|
|
|
|
|
ALTER TABLE imp_member ADD FBirthday DATETIME
|
|
|
|
|
ALTER TABLE imp_member ADD FBirthdayType CHAR
|
|
|
|
|
|
|
|
|
|
UPDATE imp_member_card SET FCompId = 1
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TCompany
|
|
|
|
|
|
|
|
|
|
UPDATE A
|
|
|
|
|
SET A.FCompId = B.FId
|
|
|
|
|
FROM imp_member AS A,TCompany AS B
|
|
|
|
|
WHERE A.<EFBFBD>Ǽ<EFBFBD><EFBFBD>ŵ<EFBFBD> = B.FWebsite
|
|
|
|
|
|
|
|
|
|
SELECT * FROM imp_member WHERE FCompId IS NULL
|
|
|
|
|
|
|
|
|
|
UPDATE imp_member_card SET FCompId = 1
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TCompany
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UPDATE imp_member SET FMemId = dbo.FNNewId() WHERE FMemId IS NULL
|
|
|
|
|
UPDATE imp_member SET FCardid = dbo.FNNewId() WHERE FCardid IS NULL
|
|
|
|
|
UPDATE imp_member SET FMemNo = <EFBFBD><EFBFBD>Ա<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
UPDATE imp_member SET FCardNo = <EFBFBD><EFBFBD>Ա<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
UPDATE imp_member SET FCreateDate = <EFBFBD>Ǽ<EFBFBD>ʱ<EFBFBD><EFBFBD>
|
|
|
|
|
UPDATE imp_member SET FExpiredDate = DATEADD(YEAR,100,<EFBFBD>Ǽ<EFBFBD>ʱ<EFBFBD><EFBFBD>)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UPDATE imp_member SET FBalance = CAST(REPLACE(<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,',','') AS FLOAT)
|
|
|
|
|
|
|
|
|
|
SELECT <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> FROM imp_member
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UPDATE imp_member SET FMobile = <EFBFBD>绰<EFBFBD>ֻ<EFBFBD>
|
|
|
|
|
UPDATE imp_member SET FName = <EFBFBD><EFBFBD>Ա<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
UPDATE imp_member SET FGender = CASE WHEN <EFBFBD>Ա<EFBFBD>= '<EFBFBD><EFBFBD>' THEN 1 ELSE 0 END
|
|
|
|
|
UPDATE imp_member SET FBirthdayType = 'G'
|
|
|
|
|
UPDATE imp_member SET FState = 1
|
|
|
|
|
UPDATE imp_member SET FState = 4 WHERE <EFBFBD><EFBFBD>ע like '%<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ע<EFBFBD><EFBFBD>%'
|
|
|
|
|
UPDATE imp_member SET Fpoint = REPLACE(Ŀǰ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>,',','')
|
|
|
|
|
UPDATE imp_member SET FMemo = <EFBFBD><EFBFBD>ע
|
|
|
|
|
UPDATE imp_member SET FCompId = dbo.FNCompID('001')
|
|
|
|
|
UPDATE imp_member SET FDeleted = 0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ALTER TABLE imp_member_card ADD FCardNo VARCHAR(50)
|
|
|
|
|
ALTER TABLE imp_member_card ADD FCardId BIGINT
|
|
|
|
|
ALTER TABLE imp_member_card ADD FCompId BIGINT
|
|
|
|
|
ALTER TABLE imp_member_card ADD FMemId BIGINT
|
|
|
|
|
ALTER TABLE imp_member_card ADD FCardTypeId BIGINT
|
|
|
|
|
ALTER TABLE imp_member_card ADD FDeleted BIT
|
|
|
|
|
ALTER TABLE imp_member_card ADD FCreateDate DATETIME
|
|
|
|
|
ALTER TABLE imp_member_card ADD FExpiredDate DATETIME
|
|
|
|
|
ALTER TABLE imp_member_card ADD FBalance DECIMAL(18,6)
|
|
|
|
|
ALTER TABLE imp_member_card ADD FRemainTimes DECIMAL(18,6)
|
|
|
|
|
ALTER TABLE imp_member_card ADD FCardTypeName VARCHAR(50)
|
|
|
|
|
|
|
|
|
|
UPDATE imp_member_card SET FCardTypeName =<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
UPDATE imp_member_card SET FDeleted =0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ALTER TABLE imp_member ALTER COLUMN <EFBFBD><EFBFBD>Ա<EFBFBD><EFBFBD><EFBFBD><EFBFBD> VARCHAR(100)
|
|
|
|
|
ALTER TABLE imp_member_card ALTER COLUMN <EFBFBD><EFBFBD>Ա<EFBFBD><EFBFBD><EFBFBD><EFBFBD> VARCHAR(100)
|
|
|
|
|
|
|
|
|
|
CREATE INDEX IX_IMPMEMBER_NO ON imp_member (<EFBFBD><EFBFBD>Ա<EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
|
|
|
|
|
CREATE INDEX IX_IMPMEMBER_CARD_NO ON imp_member_card (<EFBFBD><EFBFBD>Ա<EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DROP TABLE #Card
|
|
|
|
|
|
|
|
|
|
SELECT * FROM #Card
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
--<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
UPDATE A
|
|
|
|
|
SET A.FCardTypeID = B.FId
|
|
|
|
|
FROM imp_member_card AS A,TMemberCardType AS B
|
|
|
|
|
WHERE A.FCardTypeName = B.FName
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SELECT * FROM imp_member_card WHERE FCardTypeId IS NULL
|
|
|
|
|
|
|
|
|
|
--<EFBFBD><EFBFBD>ID
|
|
|
|
|
UPDATE imp_member_card SET FCardId = dbo.FNNewId() WHERE FCardid is null
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
--<EFBFBD><EFBFBD>ԱID
|
|
|
|
|
UPDATE A
|
|
|
|
|
SET A.FMemId = B.FMemId
|
|
|
|
|
FROM imp_member_card AS A,imp_member AS B
|
|
|
|
|
WHERE A.<EFBFBD><EFBFBD>Ա<EFBFBD><EFBFBD><EFBFBD><EFBFBD> = B.<EFBFBD><EFBFBD>Ա<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
|
|
|
|
--<EFBFBD>ŵ<EFBFBD>
|
|
|
|
|
UPDATE A
|
|
|
|
|
SET A.FCompId = B.FCompId
|
|
|
|
|
FROM imp_member_card AS A,imp_member AS B
|
|
|
|
|
WHERE B.FMemId = A.FMemId
|
|
|
|
|
|
|
|
|
|
UPDATE imp_member_card SET FCreateDate = <EFBFBD>Ǽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,FExpiredDate = <EFBFBD><EFBFBD>Ч<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
UPDATE A
|
|
|
|
|
SET A.FCreateDate = B.FCreateDate,
|
|
|
|
|
a.FExpiredDate = dateadd(year,100,B.FCreateDate)
|
|
|
|
|
FROM imp_member_card AS A,imp_member AS B
|
|
|
|
|
WHERE A.FMemId= B.FMemId
|
|
|
|
|
AND A.FCreateDate IS NULL
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
--<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
UPDATE imp_member_card SET FBalance = 0
|
|
|
|
|
|
|
|
|
|
UPDATE imp_member_card SET FBalance = CAST(REPLACE(REPLACE(<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,'Ԫ',''),',','') AS FLOAT)
|
|
|
|
|
WHERE FCardKind = 'Money'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UPDATE imp_member_card SET FRemainTimes = CAST(REPLACE(<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,'<EFBFBD><EFBFBD>','') AS FLOAT)
|
|
|
|
|
WHERE <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> LIKE '%<EFBFBD><EFBFBD>%'
|
|
|
|
|
|
|
|
|
|
UPDATE imp_member_card SET FRemainTimes = 0
|
|
|
|
|
WHERE <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> LIKE '%<EFBFBD><EFBFBD>%'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UPDATE imp_member_card SET fcompid=1
|
|
|
|
|
|
|
|
|
|
update imp_member_card SET FCardNo = <EFBFBD><EFBFBD>Ա<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
|
|
|
|
--<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͬ,<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
ALTER TABLE imp_member_card ADD FIsMaster BIT
|
|
|
|
|
UPDATE imp_member_card SET FIsMaster = 0
|
|
|
|
|
|
|
|
|
|
UPDATE A
|
|
|
|
|
SET A.FIsMaster = 1
|
|
|
|
|
FROM imp_member_card AS A,imp_member AS B
|
|
|
|
|
WHERE A.<EFBFBD><EFBFBD>Ա<EFBFBD><EFBFBD><EFBFBD><EFBFBD> = B.<EFBFBD><EFBFBD>Ա<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
and A.<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> = B.<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DROP TABLE #Card
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SELECT FCardNo
|
|
|
|
|
INTO #Card
|
|
|
|
|
FROM imp_member_card
|
|
|
|
|
WHERE FDeleted = 0
|
|
|
|
|
GROUP BY fcardNo
|
|
|
|
|
HAVING(SUM(1)) > 1
|
|
|
|
|
|
|
|
|
|
ALTER TABLE imp_member_card ADD FSeq INT IDENTITY(1,1)
|
|
|
|
|
ALTER TABLE imp_member_card ADD FCardIndex INT
|
|
|
|
|
|
|
|
|
|
CREATE INDEX IDX_imp_member_card_SEQ ON imp_member_card(FSeq)
|
|
|
|
|
|
|
|
|
|
UPDATE imp_member_card SET FCardIndex = 0
|
|
|
|
|
|
|
|
|
|
UPDATE A
|
|
|
|
|
SET A.FCardIndex = 1+ (SELECT COUNT(1) FROM imp_member_card AS B WHERE B.<EFBFBD><EFBFBD>Ա<EFBFBD><EFBFBD><EFBFBD><EFBFBD> = A.<EFBFBD><EFBFBD>Ա<EFBFBD><EFBFBD><EFBFBD><EFBFBD> AND (B.FIsMaster > A.FIsMaster OR B.FSeq > A.FSeq) )
|
|
|
|
|
FROM imp_member_card AS A
|
|
|
|
|
WHERE FCardNo IN(SELECT FCardNo FROM #Card)
|
|
|
|
|
AND A.FIsMaster = 0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
update imp_member_card SET FCardNo = FCardNo + '.' + CAST(FCardINdex as varchar)
|
|
|
|
|
WHERE FCardNo IN(SELECT FCardNo FROM #Card)
|
|
|
|
|
AND FIsMaster = 0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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,
|
|
|
|
|
ISNULL(FMemo,'') AS FMemo,
|
|
|
|
|
'<EFBFBD>Ӳ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' AS FCustom1,'' AS FCustom2,'' AS FCustom3,'' AS FCustom4,'' AS FCustom5
|
|
|
|
|
from imp_member
|
|
|
|
|
WHERE FDeleted = 0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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,
|
|
|
|
|
1 AS FState,
|
|
|
|
|
FCreateDate AS FCreateDate,
|
|
|
|
|
FExpiredDate AS FExpiredDate,
|
|
|
|
|
0 AS FTotalTimes,
|
|
|
|
|
0 AS FUsedTimes,
|
|
|
|
|
FCompId AS FSaleCompId,
|
|
|
|
|
0 AS FSaleBillId,
|
|
|
|
|
ISNULL('','') AS FMemo
|
|
|
|
|
FROM imp_member_card
|
|
|
|
|
WHERE FDeleted = 0
|
|
|
|
|
AND FCardKind = 'Money'
|
|
|
|
|
AND FCardId NOT IN(SELECT FCardId FROM TMemberCard)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
INSERT TMemberCardAccount(FMemId,FId,FCardId,FAcctId,FDeposit,FBalance,FArrear,FCreateDate,FExpiredDate,FMemo)
|
|
|
|
|
SELECT FMemId,dbo.FNNewId(),FCardId AS FCardId,3,CAST(FBalance AS FLOAT),CAST(FBalance AS FLOAT),0,FCreateDate,NULL AS FExpiredDate,''
|
|
|
|
|
FROM imp_member_card AS A
|
|
|
|
|
WHERE FCardKind = 'Money'
|
|
|
|
|
and FDeleted = 0
|
|
|
|
|
AND FCardId NOT IN(SELECT FCardId FROM TMemberCardAccount)
|
|
|
|
|
|
|
|
|
|
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,'',CAST(FBalance AS FLOAT),0,CAST(FBalance AS FLOAT),0,getdate(),'<EFBFBD>Ӳ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>е<EFBFBD><EFBFBD><EFBFBD>'
|
|
|
|
|
FROM imp_member_card AS A
|
|
|
|
|
WHERE FCardKind = 'Money'
|
|
|
|
|
and FDeleted = 0
|
|
|
|
|
AND FCardId NOT IN(SELECT FCardId FROM TMemberCardAcctHist)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
INSERT TMemberPointHist(FId,FMemId,FTime,FCardId,FCompId,FBillType,FBizType,FTransId,FTransNo,FInAmount,FOutAmount,FBalance,FMemo,FRecordTime)
|
|
|
|
|
SELECT dbo.FNNewId(),A.FMemId,getdate(),0,1,'DR','Import',0,'',FPoint,0,FPoint,'',getdate()
|
|
|
|
|
FROM imp_member AS A WHERE FPoint != 0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
--<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʷ
|
|
|
|
|
|
|
|
|
|
ALTER TABLE imp_member_rchg_hist ADD FMemId BIGINT
|
|
|
|
|
ALTER TABLE imp_member_rchg_hist ADD FCardId BIGINT
|
|
|
|
|
ALTER TABLE imp_member_rchg_hist ADD FCompId BIGINT
|
|
|
|
|
|
|
|
|
|
ALTER TABLE imp_member_cons_hist ADD FMemId BIGINT
|
|
|
|
|
ALTER TABLE imp_member_cons_hist ADD FCardId BIGINT
|
|
|
|
|
ALTER TABLE imp_member_cons_hist ADD FCompId BIGINT
|
|
|
|
|
|
|
|
|
|
UPDATE A
|
|
|
|
|
SET A.FMemId = B.FMemId,
|
|
|
|
|
A.FCardId = B.FCardId,
|
|
|
|
|
A.FCompId = B.FCompId
|
|
|
|
|
FROM imp_member_rchg_hist AS A,imp_member AS B
|
|
|
|
|
WHERE A.<EFBFBD><EFBFBD>Ա<EFBFBD><EFBFBD><EFBFBD><EFBFBD>= B.<EFBFBD><EFBFBD>Ա<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
|
|
|
|
UPDATE A
|
|
|
|
|
SET A.FMemId = B.FMemId,
|
|
|
|
|
A.FCardId = B.FCardId,
|
|
|
|
|
A.FCompId = B.FCompId
|
|
|
|
|
FROM imp_member_cons_hist AS A,imp_member AS B
|
|
|
|
|
WHERE A.<EFBFBD><EFBFBD>Ա<EFBFBD><EFBFBD><EFBFBD><EFBFBD>= B.<EFBFBD><EFBFBD>Ա<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TRUNCATE TABLE imp_member_cons_hist
|
|
|
|
|
TRUNCATE TABLE imp_member_rchg_hist
|
|
|
|
|
|
|
|
|
|
INSERT TMemberOldTransHist(FId,FMemId,FTime,FCardId,FCompId,FBillType,FBizType,FTransNo,FContent,FPrice,FQuantity,FAmount,FPayment,FEmployee,FMemo)
|
|
|
|
|
SELECT DBO.FNNewId(),A.FMemId,A.<EFBFBD><EFBFBD>ֵʱ<EFBFBD><EFBFBD>,A.FCardId,A.FCompId,'DR','<EFBFBD><EFBFBD>ֵ','','[<EFBFBD><EFBFBD>ֵ]' +<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,<EFBFBD><EFBFBD>ֵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>,1,<EFBFBD><EFBFBD>ֵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>,<EFBFBD><EFBFBD>ֵ<EFBFBD><EFBFBD>ʽ,'',''
|
|
|
|
|
FROM imp_member_rchg_hist AS A
|
|
|
|
|
WHERE ISNULL(FMemId,0) != 0
|
|
|
|
|
|
|
|
|
|
INSERT TMemberOldTransHist(FId,FMemId,FTime,FCardId,FCompId,FBillType,FBizType,FTransNo,FContent,FPrice,FQuantity,FAmount,FPayment,FEmployee,FMemo)
|
|
|
|
|
SELECT DBO.FNNewId(),A.FMemId,A.<EFBFBD>Ǽ<EFBFBD>ʱ<EFBFBD><EFBFBD>,A.FCardId,A.FCompId,'DR','<EFBFBD><EFBFBD><EFBFBD><EFBFBD>',<EFBFBD><EFBFBD>ˮ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>,'[<EFBFBD><EFBFBD><EFBFBD><EFBFBD>]' + <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀ,<EFBFBD><EFBFBD><EFBFBD>ѽ<EFBFBD><EFBFBD><EFBFBD>,1,<EFBFBD><EFBFBD><EFBFBD>ѽ<EFBFBD><EFBFBD><EFBFBD>,<EFBFBD><EFBFBD><EFBFBD>ѷ<EFBFBD>ʽ,'',''
|
|
|
|
|
FROM imp_member_cons_hist AS A
|
|
|
|
|
WHERE ISNULL(FMemId,0) != 0
|
|
|
|
|
|
|
|
|
|
UPDATE TMemberOldTransHist SET FContent = '['+FBizType+']' + FContent WHERE FMemId IN(SELECT FMemId FROM imp_member)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DELETE A
|
|
|
|
|
FROM imp_member_cons_hist AS A,(SELECT <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFB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chg_hist ALTER COLUMN <EFBFBD><EFBFBD>Ա<EFBFBD><EFBFBD><EFBFBD><EFBFBD> VARCHAR(100) NOT NULL
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ALTER TABLE imp_member_cons_hist ADD FSeq INT IDENTITY(1,1)
|
|
|
|
|
ALTER TABLE imp_member_rchg_hist ADD FSeq INT IDENTITY(1,1)
|
|
|
|
|
|
|
|
|
|
DELETE TMemberOldTransHist WHERE FMemId IN(SELECT FMemId FROM imp_member)
|
|
|
|
|
|
|
|
|
|
CREATE INDEX IX_imp_memberRchgHist_CardNo ON imp_member_rchg_hist(<EFBFBD><EFBFBD>Ա<EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
|
|
|
|
|
CREATE INDEX IX_imp_memberConsHist_CardNo ON imp_member_cons_hist(<EFBFBD><EFBFBD>Ա<EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
|
|
|
|
|
|
|
|
|
|
--<EFBFBD>Ƴ<EFBFBD>
|
|
|
|
|
SELECT dbo.FNNewId() AS FId,dbo.FNNewId() AS FCourseId,FNo,FName
|
|
|
|
|
|
|
|
|
|
CREATE TABLE TImpItem
|
|
|
|
|
(
|
|
|
|
|
FId BIGINT,
|
|
|
|
|
FCourseId BIGINT,
|
|
|
|
|
FNo VARCHAR(MAX),
|
|
|
|
|
FName VARCHAR(MAX)
|
|
|
|
|
)
|
|
|
|
|
INSERT INTO TImpItem(FId,FCourseId,FNo,FName)
|
|
|
|
|
SELECT dbo.FNNewId() AS FId,dbo.FNNewId() AS FCourseId,FNo,FName
|
|
|
|
|
|
|
|
|
|
FROM (
|
|
|
|
|
select <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> AS FNo, <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> AS FName
|
|
|
|
|
from imp_member_card
|
|
|
|
|
WHERE ISNULL(FCardKind,'') = 'Course'
|
|
|
|
|
AND <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> NOT IN(SELECT FName FROM TCourse)
|
|
|
|
|
GROUP BY <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
|
|
|
|
) AS A
|
|
|
|
|
GROUP BY FNo,FName
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
select <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> AS FNo, <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> AS FName
|
|
|
|
|
from imp_member_card
|
|
|
|
|
WHERE <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> LIKE '%<EFBFBD><EFBFBD>%'
|
|
|
|
|
AND <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> NOT IN(SELECT FName FROM TCourse)
|
|
|
|
|
GROUP BY <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
INSERT TItem(FId,FNo,FNoOfPad,FName,FAbbr,FTypeId,FBriefCode,FDescription,FPriceMode,FIsService,FStatTimes,FCustom1,FCustom2,FCustom3,FEnabled,FPrice,FVipPrice,FTime,FDctId,FPointMode,FPointValue,FDeptId,FAllowBooking)
|
|
|
|
|
SELECT FId,FNo,FName,FName,FName,0,dbo.FNGetFirstPinYin(FName),'''',1,1,1,'''','''','''',1,0,0,0,0,0,0,0,1
|
|
|
|
|
FROM TImpItem
|
|
|
|
|
WHERE FId NOT IN(SELECT FId FROM TItem)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
INSERT INTO TCourse(FId,FNo,FName,FBriefCode,FItemId,FPackId,FSequence,FTypeId,FTimes,FFreeTimes,FDurable,FValidityPeriodUnit,FValidityPeriod,FCreateDate,FExpiredDate,FDescription,FEnabled,FPrice,FAmount,FCalcMode)
|
|
|
|
|
SELECT FCourseId AS FId,
|
|
|
|
|
A.FNo + 'L1',
|
|
|
|
|
A.FName AS FName,
|
|
|
|
|
'' AS FBriefCode,
|
|
|
|
|
A.FId AS FItemId,
|
|
|
|
|
0 AS FPackId,
|
|
|
|
|
1 AS FSequence,
|
|
|
|
|
(SELECT TOP 1 FId FROM TBasicType WHERE FKey = 'CourseType') AS FTypeId,
|
|
|
|
|
1 AS FTimes,
|
|
|
|
|
0 AS FFreeTimes,
|
|
|
|
|
0 AS FDurable,
|
|
|
|
|
0 AS FValidityPeriodUnit,
|
|
|
|
|
0 AS FValidityPeriod,
|
|
|
|
|
getdate() AS FCreateDate,
|
|
|
|
|
NULL AS FExpiredDate,
|
|
|
|
|
'' AS FDescription,
|
|
|
|
|
1 AS FEnabled,
|
|
|
|
|
0 AS FPrice,
|
|
|
|
|
0 AS FAmount,
|
|
|
|
|
1 AS FCalcMode
|
|
|
|
|
FROM TImpItem AS A
|
|
|
|
|
WHERE FId NOT IN(SELECT FItemId FROM TCourse)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ALTER TABLE imp_member_card ADD FItemId BIGINT
|
|
|
|
|
|
|
|
|
|
UPDATE A
|
|
|
|
|
SET A.FItemId = B.FId,
|
|
|
|
|
A.FCardTypeId = B.FCourseId
|
|
|
|
|
FROM TImpItem AS B,imp_member_card AS A
|
|
|
|
|
WHERE B.FNo = A.<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
AND A.FCardKind = 'Course'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SELECT * FROM imp_member_card
|
|
|
|
|
|
|
|
|
|
ALTER TABLE imp_member_card ADD FMemo VARCHAR(1000)
|
|
|
|
|
|
|
|
|
|
update imp_member_card SET FMemo = ''
|
|
|
|
|
|
|
|
|
|
update imp_member_card SET FMemo = <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> WHERE <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> LIKE '%<EFBFBD><EFBFBD>%'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
--<EFBFBD>Ƴ<EFBFBD>
|
|
|
|
|
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,FCardTypeId,0,FItemId,FCompId,FRemainTimes,0,0,0,0,FCreateDate,FExpiredDate,'DR.Import',0,0,0,FMemo,1,0
|
|
|
|
|
FROM imp_member_card AS A
|
|
|
|
|
WHERE FCardKind = 'Course'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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(FCardTypeId,0),getdate(),FRemainTimes,0,0,0,FCompId,'DR','Import',0,'',0,getdate()
|
|
|
|
|
FROM imp_member_card AS A
|
|
|
|
|
WHERE FCardKind = 'Course'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DELETE TMemberCardType WHERE FName NO
|
|
|
|
|
|
|
|
|
|
SELECT * FROM imp_memberConsHist_1
|
|
|
|
|
|
|
|
|
|
SELECT * FROM imp_member_card
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
use KunMing_ALa_TuQiaoDian
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
select replace('bc 06 88 d7 30 dd de 85 bc 71 d8 86 1d 5d 8b c7 22 14 dd ae',' ','')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DELETE TMember WHERE FMemId IN(SELECT FMemId FROM imp_member)
|
|
|
|
|
|
|
|
|
|
DELETE TMemberCardAccount WHERE FMemId IN(SELECT FMemId FROM imp_member)
|
|
|
|
|
|
|
|
|
|
DELETE TMemberOldTransHist WHERE FMemId IN(SELECT FMemId FROM imp_member)
|
|
|
|
|
|
|
|
|
|
DELETE TItem WHERE FId IN(SELECT FId FROM TImpItem)
|
|
|
|
|
DELETE TItemSub WHERE FItemId IN(SELECT FId FROM TImpItem)
|
|
|
|
|
DELETE TCourse WHERE FItemId IN(SELECT FId FROM TImpItem)
|
|
|
|
|
|
|
|
|
|
DELETE TMemberCardType WHERE FId > 9
|
|
|
|
|
|
|
|
|
|
DELETE TMemberCardTypesUB
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DROP TABLE imp_member_cons_hist
|
|
|
|
|
|
|
|
|
|
DELETE TImpItem
|
|
|
|
|
|
|
|
|
|
SELECT * FROM sysobjects WHERE name like 'TImp%'
|