|
|
|
|
use TENGCHONG_FENGNIANG
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DROP TABLE TImpMemberCourse
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TImpMemberCourse WHERE FMemNo
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TItem WHERE FNo = '<EFBFBD><EFBFBD>Ĥ'
|
|
|
|
|
|
|
|
|
|
ALTER TABLE TImpMemberCourse ADD FIsNew BIT
|
|
|
|
|
ALTER TABLE TImpMemberCourse ADD FId BIGINT
|
|
|
|
|
ALTER TABLE TImpMemberCourse ADD FMemId BIGINT
|
|
|
|
|
ALTER TABLE TImpMemberCourse ADD FCourseId BIGINT
|
|
|
|
|
ALTER TABLE TImpMemberCourse ADD FItemId BIGINT
|
|
|
|
|
ALTER TABLE TImpMemberCourse ADD FCompId BIGINT
|
|
|
|
|
ALTER TABLE TImpMemberCourse ADD FPurTimes DECIMAL(18,6)
|
|
|
|
|
ALTER TABLE TImpMemberCourse ADD FUsedTimes DECIMAL(18,6)
|
|
|
|
|
ALTER TABLE TImpMemberCourse ADD FCalcMode INT
|
|
|
|
|
ALTER TABLE TImpMemberCourse ADD FExpiredDate DateTime
|
|
|
|
|
ALTER TABLE TImpMemberCourse ADD FGender INT
|
|
|
|
|
ALTER TABLE TImpMemberCourse ADD FName VARCHAR(100)
|
|
|
|
|
ALTER TABLE TImpMemberCourse ADD FMobile VARCHAR(100)
|
|
|
|
|
ALTER TABLE TImpMemberCourse ADD FMemNo VARCHAR(100)
|
|
|
|
|
|
|
|
|
|
UPDATE TImpMemberCourse SET FMemNO = <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
UPDATE TImpMemberCourse SET FIsNew = 0
|
|
|
|
|
UPDATE TImpMemberCourse SET FName = <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
UPDATE TImpMemberCourse SET FMobile = <EFBFBD>ֻ<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
UPDATE TImpMemberCourse SET FGender = 0
|
|
|
|
|
UPDATE TImpMemberCourse SET FExpiredDate = ʹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
UPDATE TImpMemberCourse SET FPurTimes = ʣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
UPDATE TImpMemberCourse SET FUsedTimes = 0
|
|
|
|
|
UPDATE TImpMemberCourse SET FCompId = 1
|
|
|
|
|
UPDATE TImpMemberCourse SET FCalcMode = 1
|
|
|
|
|
UPDATE TImpMemberCourse SET FId = dbo.FNNewId() WHERE FId IS NULL
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UPDATE A
|
|
|
|
|
SET A.FItemId = B.FId
|
|
|
|
|
FROM TImpMemberCourse AS A,TItem AS B
|
|
|
|
|
WHERE A.<EFBFBD><EFBFBD>Ŀ<EFBFBD><EFBFBD><EFBFBD><EFBFBD> = B.FNo
|
|
|
|
|
|
|
|
|
|
UPDATE A
|
|
|
|
|
SET A.FCOurseId = B.FId
|
|
|
|
|
FROM TImpMemberCourse AS A,TCourse AS B
|
|
|
|
|
WHERE A.FItemId = B.FItemId
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
update TImpMemberCourse SET FIsNew = 1,FMemId = dbo.FNNewId() WHERE FMemId IS NULL
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TImpMemberCourse WHERE FIsNew = 1 AND FMemNo IN(SELECT FMemNO FROM TMember)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UPDATE A
|
|
|
|
|
SET A.FMemId = B.FMemID
|
|
|
|
|
FROM TImpMemberCourse AS A,TMember AS B
|
|
|
|
|
WHERE A.FMemNO = B.FMemNo
|
|
|
|
|
|
|
|
|
|
UPDATE A
|
|
|
|
|
SET A.FMemId = B.FMemId
|
|
|
|
|
FROM TImpMemberCourse A ,(
|
|
|
|
|
SELECT FMemNO,MIN(FMemId) AS FMemId
|
|
|
|
|
FROM TImpMemberCourse
|
|
|
|
|
WHERE FIsNew = 1
|
|
|
|
|
GROUP BY FMemNO
|
|
|
|
|
HAVING(SUM(1) > 1)) AS B
|
|
|
|
|
WHERE A.FMemNo = B.FMemNO
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TImpMemberCourse WHERE FMemNo = '80001897'
|
|
|
|
|
|
|
|
|
|
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,
|
|
|
|
|
ISNULL(getdate() ,'1900-01-01') AS FCreateDate,
|
|
|
|
|
FGender AS FGender,
|
|
|
|
|
'g' AS FBirthdayType,
|
|
|
|
|
null AS FBirthday,
|
|
|
|
|
'' AS FTelephone,
|
|
|
|
|
ISNULL('','') AS FMobilePhone,
|
|
|
|
|
'' AS FQQ,
|
|
|
|
|
'' AS FWeChat,
|
|
|
|
|
'' AS FIdCard,
|
|
|
|
|
'' AS FEmail,
|
|
|
|
|
'' AS FAddress,
|
|
|
|
|
0 AS FProId,
|
|
|
|
|
'' AS FCPW,
|
|
|
|
|
'' AS FQPW,
|
|
|
|
|
0 AS FChargeEmpId,
|
|
|
|
|
ISNULL( 0,0) AS FPoint,
|
|
|
|
|
1 AS FRecvConsSMS,
|
|
|
|
|
1 AS FRecvBulkSMS,
|
|
|
|
|
ISNULL('','') AS FMemo,
|
|
|
|
|
'' AS FCustom1,'' AS FCustom2,'' AS FCustom3,'' AS FCustom4,'' AS FCustom5
|
|
|
|
|
from TImpMemberCourse
|
|
|
|
|
WHERE FIsNew = 1
|
|
|
|
|
GROUP BY FMemId,FMemNo,FName,FGender,FCompId
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UPDATE TImpMemberCourse SET FCompId = 1
|
|
|
|
|
UPDATE TImpMemberCourse SET FId = dbo.FNNewId()
|
|
|
|
|
|
|
|
|
|
UPDATE TImpMemberCourse SET FCalcMode = CASE WHEN <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> IN( '<EFBFBD>꿨','<EFBFBD><EFBFBD><EFBFBD><EFBFBD>') THEN 2 ELSE 1 END
|
|
|
|
|
|
|
|
|
|
UPDATE TCourse SET FCalcMode = 2 WHERE FId = 7883450327372601565
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TCourse
|
|
|
|
|
|
|
|
|
|
UPDATE
|
|
|
|
|
|
|
|
|
|
SELECT <EFBFBD><EFBFBD>Ŀ,<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
FROM TImpMemberCourse
|
|
|
|
|
GROUP BY <EFBFBD><EFBFBD>Ŀ,<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
|
|
|
|
UPDATE A
|
|
|
|
|
SET A.FMemId = B.FMemID
|
|
|
|
|
FROM TImpMemberCourse AS A,TMember AS B
|
|
|
|
|
WHERE A.<EFBFBD><EFBFBD><EFBFBD><EFBFBD> = B.FMemNo
|
|
|
|
|
|
|
|
|
|
UPDATE A
|
|
|
|
|
SET A.FCourseId = B.FId,
|
|
|
|
|
A.FItemId = B.FItemId
|
|
|
|
|
FROM TImpMemberCourse AS A,TItem AS C,TCourse AS B
|
|
|
|
|
WHERE A.<EFBFBD><EFBFBD>Ŀ = C.FNo
|
|
|
|
|
AND C.FId = B.FItemId
|
|
|
|
|
|
|
|
|
|
UPDATE A
|
|
|
|
|
SET A.FPurTimes = CAST(<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> AS FLOAT),
|
|
|
|
|
A.FUsedTimes = cast(<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> as float) - ʣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
FROM TImpMemberCourse AS A
|
|
|
|
|
|
|
|
|
|
WHERE <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> NOT IN( '<EFBFBD>꿨','<EFBFBD><EFBFBD><EFBFBD><EFBFBD>')
|
|
|
|
|
|
|
|
|
|
UPDATE TImpMemberCourse SET FPurTimes = 0,FUsedTimes = 0
|
|
|
|
|
|
|
|
|
|
ALTER TABLE TImpMemberCourse ADD Times VARCHAR(100)
|
|
|
|
|
|
|
|
|
|
UPDATE TImpMemberCourse SET Times = <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> WHERE <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> NOT IN( '<EFBFBD>꿨','<EFBFBD><EFBFBD><EFBFBD><EFBFBD>')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
select * from TImpMemberCourse WHERE Times = '<EFBFBD><EFBFBD><EFBFBD><EFBFBD>'
|
|
|
|
|
|
|
|
|
|
UPDATE TImpMember
|
|
|
|
|
|
|
|
|
|
UPDATE TImpMemberCourse SET FExpiredDate = DATEADD(DAY,cast(ʧЧ<EFBFBD><EFBFBD><EFBFBD><EFBFBD> as int),'1900-01-01')
|
|
|
|
|
FROM TImpMemberCourse
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DELETE TCourse WHERE FName IN(SELECT <EFBFBD><EFBFBD>Ŀ FROM TImpMemberCourse)
|
|
|
|
|
|
|
|
|
|
INSERT INTO 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
|
|
|
|
|
|
|
|
|
|
SELECT * INTO #Course FROM TCourse WHERE 1=0
|
|
|
|
|
|
|
|
|
|
SELECT * FROM #Course
|
|
|
|
|
|
|
|
|
|
UPDATE #Course SET FNo = FNo + '-<EFBFBD>꿨', FName = FName + '-<EFBFBD>꿨' WHERE FCalcMode = 2
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DROP TABLE #Course
|
|
|
|
|
INSERT INTO TCourse(FId,FNo,FName,FBriefCode,FItemId,FPackId,FSequence,FTypeId,FTimes,FFreeTimes,FDurable,FValidityPeriodUnit,FValidityPeriod,FCreateDate,FExpiredDate,FDescription,FEnabled,FPrice,FAmount,FCalcMode,
|
|
|
|
|
FPointMode,FPOintValue,FAcctId,FDeposit)
|
|
|
|
|
|
|
|
|
|
SELECT dbo.FNNewId() AS FId,
|
|
|
|
|
I.FNo ,
|
|
|
|
|
I.FName AS FName,
|
|
|
|
|
'' AS FBriefCode,
|
|
|
|
|
I.FId AS FItemId,
|
|
|
|
|
0 AS FPackId,
|
|
|
|
|
1 AS FSequence,
|
|
|
|
|
0 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, 0 AS FPointMode,
|
|
|
|
|
0 AS FPointValue,0,0
|
|
|
|
|
FROM TItem AS I,TImpMemberCourse AS B
|
|
|
|
|
|
|
|
|
|
WHERE I.FId = B.FItemId
|
|
|
|
|
|
|
|
|
|
GROUP BY FNo,I.FName ,I.FId
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TItem WHERE FNo IN(SELECT <EFBFBD><EFBFBD>Ŀ FROM TImpMemberCourse)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DROP TABLE TImpMemberCourse
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
INSERT TMemberCourse(FId,FMemId,FCourseId,FMemPackId,FItemId,FCompId,FPurTimes,FPurAmount,FFreeTimes,FUsedPurTimes,FFreeAmount,FPurchaseDate,FExpiredDate,FBizType,FTransId,FArrear,FDurable,FMemo,FCalcMode,FAdjustPrice)
|
|
|
|
|
SELECT FId,FMemId,FCourseId,0,FItemId,FCompId,FPurTimes,ISNULL(0,0) AS FPurAmount,0,
|
|
|
|
|
FUsedTimes,0,getdate() as FCreateDate,FExpiredDate,'DR.Import',0,0,0,'',1, ISNULL(0,0) as FAdjustPrice
|
|
|
|
|
FROM TImpMemberCourse
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TImpMemberCourse WHERE FMemID is null
|
|
|
|
|
--WHERE FCourseId IS NOT NULL
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
AND FId NOT IN(SELECT FId FROM TMemberCourse)
|
|
|
|
|
|
|
|
|
|
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.FId AS FCardId,0, ISNULL(FCourseId,0),getdate(),FPurTimes + 0 ,0,FUsedTimes,0,FCompId,'DR','Import',0,'',0,getdate()
|
|
|
|
|
FROM TImpMemberCourse AS A
|