|
|
|
|
DROP TABLE TImpCOurse#
|
|
|
|
|
|
|
|
|
|
EXEC PExecImportSQL '
|
|
|
|
|
|
|
|
|
|
select FMemId,gin01c AS FItemNo,gim01c AS FMemNo,gim02c AS FMemName,gim04c AS FMobile,FPurTimes,FUsedPurTimes,dbo.FNBKDate(gin07d) AS FCreateDate
|
|
|
|
|
INTO TImpCOurse# from {fdb}.gim23,{fdb}.gim24
|
|
|
|
|
where gin00c = gim00c
|
|
|
|
|
and gim010c = gin010c
|
|
|
|
|
order by gim01c'
|
|
|
|
|
|
|
|
|
|
select * from TImpCOurse# WHERE FMemId IS NULL
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UPDATE TImpCOurse# SET FMemNo = FMobile
|
|
|
|
|
WHERE FMemId IS NULL --AND ISNULL(FMemNo,'') = 'ɢ<EFBFBD><EFBFBD>'
|
|
|
|
|
AND FMobile IS NOT NULL
|
|
|
|
|
|
|
|
|
|
UPDATE TImpCOurse# SET FMemNo = FMemName
|
|
|
|
|
WHERE FMemNo = 'ɢ<EFBFBD><EFBFBD>'
|
|
|
|
|
AND FMemName != 'ɢ<EFBFBD><EFBFBD>'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TCourse
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TUser
|
|
|
|
|
|
|
|
|
|
ALTER TABLE TImpCOurse# ADD FCourseID BIGINT
|
|
|
|
|
ALTER TABLE TImpCOurse# ADD FItemId BIGINT
|
|
|
|
|
ALTER TABLE TImpCOurse# ADD FId BIGINT
|
|
|
|
|
|
|
|
|
|
UPDATE TImpCOurse# SET FId = dbo.FNNewId()
|
|
|
|
|
|
|
|
|
|
UPDATE A
|
|
|
|
|
SET A.FItemId = B.FId
|
|
|
|
|
FROM TItem AS B,TImpCOurse# AS A
|
|
|
|
|
WHERE A.FItemNo = B.FNo
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UPDATE A
|
|
|
|
|
SET A.FCourseId = B.FId
|
|
|
|
|
FROM TCourse AS B,TImpCOurse# AS A
|
|
|
|
|
WHERE A.FItemId = B.FItemId
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SELECT A.FMemId,FCourseId,A.FPurTimes,A.FUsedPurTimes
|
|
|
|
|
FROM TImpCOurse# AS A
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TImpCourse# WHERE FMemNo = '888888'
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TMem
|
|
|
|
|
|
|
|
|
|
DELETE TImpCourse# WHERE FMemId = 8193918022168196802
|
|
|
|
|
|
|
|
|
|
INSERT TMemberCourse(FId,FMemId,FCourseId,FMemPackId,FItemId,FCompId,FPurTimes,FUsedPurTimes,FPurAmount,FFreeTimes,FFreeAmount,FPurchaseDate,FExpiredDate,FBizType,FTransId,FArrear,FDurable,FMemo,FCalcMode,FAdjustPrice)
|
|
|
|
|
SELECT FId,A.FMemId,FCourseId,0,FItemId,1,FPurTimes,FUsedPurTimes,0,0,0,getdate(),null,'DR', 0,0,0,'',1,0
|
|
|
|
|
FROM TImpCOurse# AS A
|
|
|
|
|
WHERE FMemId NOT IN(SELECT FMemId FROM TMember)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TImpCourse# WHERE FMemId = 8193918022168196802
|
|
|
|
|
|
|
|
|
|
INSERT INTO TMemberCourseHist(FId,FMemId,FMemCourseId,FPackId,FCourseId,FTime,FPurTimes,FFreeTimes,FUsePurTimes,FUseFreeTimes,
|
|
|
|
|
FPurAmount,FFreeAmount,FUsePurAmount,FUseFreeAmount,FCompId,
|
|
|
|
|
FBillType,FBizType,FTransId,FTransNo,FTransDetailId)
|
|
|
|
|
|
|
|
|
|
SELECT dbo.FNNewId(),FMemId,FId,0,FCourseId,FTime = getdate(),FPurTimes,FFreeTimes = 0,FUsedPurTimes,0,
|
|
|
|
|
FPurAmount = 0 ,0,0,0,1,
|
|
|
|
|
'DR','Import',0,'',0
|
|
|
|
|
FROM TImpCOurse#
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TMember WHERE FMobilePhone = '18660002803'
|
|
|
|
|
|
|
|
|
|
DROP TABLE TImpNewMember#
|
|
|
|
|
|
|
|
|
|
ALTER TABLE TImpCOurse# ADD FIsNew BIT NOT NULL DEFAULT 0
|
|
|
|
|
|
|
|
|
|
UPDATE TImpCOurse# SET FIsNew = 1 WHERE FMemId IS NULL
|
|
|
|
|
|
|
|
|
|
SELECT dbo.FNNewId() AS FMemId, FMemNo,MAX(ISNULL(FMemName,'')) AS FMemName,MAX(ISNULL(FMobile,'')) AS FMobile
|
|
|
|
|
into TImpNewMember# FROM TImpCOurse# WHERE FMemId IS NULL GROUP BY FMemNo
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TImpNewMember#
|
|
|
|
|
|
|
|
|
|
UPDATE A
|
|
|
|
|
SET A.FMemId = B.FMemId
|
|
|
|
|
FROM TImpCOurse# AS A,TImpNewMember# AS B
|
|
|
|
|
WHERE A.FMemNo = B.FMemNo
|
|
|
|
|
|
|
|
|
|
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 FId,
|
|
|
|
|
FMemNo AS FNo,
|
|
|
|
|
FMemName AS FName,
|
|
|
|
|
dbo.FNGetFirstPinYin(FMemName) AS FBriefCode,
|
|
|
|
|
0 AS FTypeId,
|
|
|
|
|
1 AS FCompId,
|
|
|
|
|
getdate() AS FCreateDate,
|
|
|
|
|
0 AS FGender,
|
|
|
|
|
'G' AS FBirthdayType,
|
|
|
|
|
NULL AS FBirthday,
|
|
|
|
|
'' AS FTelephone,
|
|
|
|
|
FMobile AS FMobilePhone,
|
|
|
|
|
'' AS FQQ,
|
|
|
|
|
'' AS FWeChat,
|
|
|
|
|
'' AS FIdCard,
|
|
|
|
|
'' AS FEmail,
|
|
|
|
|
'' AS FAddress,
|
|
|
|
|
0 AS FProId,
|
|
|
|
|
'' AS FCPW,
|
|
|
|
|
'' AS FQPW,
|
|
|
|
|
0 AS FChargeEmpId,
|
|
|
|
|
0 AS FPoint,
|
|
|
|
|
1 AS FRecvConsSMS,
|
|
|
|
|
1 AS FRecvBulkSMS,
|
|
|
|
|
'<EFBFBD>ӼĴ<EFBFBD><EFBFBD><EFBFBD>Ʒ<EFBFBD>е<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ļ<EFBFBD>Ա' AS FMemo,
|
|
|
|
|
'' AS FCustom1,'' AS FCustom2,'' AS FCustom3,'' AS FCustom4,'' AS FCustom5
|
|
|
|
|
from TImpNewMember#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DELETE TMember WHERE FMemId IN(SELECT FMemId FROM TImpNewMember#)
|