|
|
|
|
|
|
|
|
|
ALTER TABLE TImpMember ADD FCardTypeName VARCHAR(100)
|
|
|
|
|
ALTER TABLE TImpMember ADD FMemId BIGINT
|
|
|
|
|
ALTER TABLE TImpMember ADD FMemNo VARCHAR(50)
|
|
|
|
|
ALTER TABLE TImpMember ADD FCardNo VARCHAR(50)
|
|
|
|
|
ALTER TABLE TImpMember ADD FName VARCHAR(50)
|
|
|
|
|
ALTER TABLE TImpMember ADD FGender INT
|
|
|
|
|
ALTER TABLE TImpMember ADD FCardState INT
|
|
|
|
|
ALTER TABLE TImpMember ADD FMobile VARCHAR(50)
|
|
|
|
|
ALTER TABLE TImpMember ADD FCardTypeId BIGINT
|
|
|
|
|
ALTER TABLE TImpMember ADD FCourseId BIGINT
|
|
|
|
|
ALTER TABLE TImpMember ADD FBalance DECIMAL(18,6)
|
|
|
|
|
ALTER TABLE TImpMember ADD FBalance2 DECIMAL(18,6)
|
|
|
|
|
ALTER TABLE TImpMember ADD FRemainTimes INT
|
|
|
|
|
ALTER TABLE TImpMember ADD FPurTimes INT
|
|
|
|
|
ALTER TABLE TImpMember ADD FPurAmount DECIMAL(18,6)
|
|
|
|
|
ALTER TABLE TImpMember ADD FItemId BIGINT
|
|
|
|
|
ALTER TABLE TImpMember ADD FCreateDate DATETIME
|
|
|
|
|
ALTER TABLE TImpMember ADD FExpiredDate DATETIME
|
|
|
|
|
ALTER TABLE TImpMember ADD FCompId BIGINT
|
|
|
|
|
ALTER TABLE TImpMember ADD FCardId BIGINT
|
|
|
|
|
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 FBirthday DATETIME
|
|
|
|
|
ALTER TABLE TImpMember ADD FBirthdayType CHAR
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TImpMember
|
|
|
|
|
WHERE <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> NOT IN(SELECT FName FROM TMemberCardType)
|
|
|
|
|
|
|
|
|
|
select * from tmembercardtype
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UPDATE TImpMember SET FMemId = dbo.FNNewId() WHERE FMemId IS NULL
|
|
|
|
|
|
|
|
|
|
UPDATE TImpMember SET FCardId = dbo.FNNewId() WHERE FCardId IS NULL
|
|
|
|
|
|
|
|
|
|
UPDATE TImpMember SET FMemNo = <EFBFBD><EFBFBD>Ա<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
UPDATE TImpMember SET FCardno = <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
UPDATE TImpMember SET FName = <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
UPDATE TImpMember SET FMobile = <EFBFBD>ֻ<EFBFBD>
|
|
|
|
|
UPDATE TImpMember SET FGender = CASE WHEN <EFBFBD>Ա<EFBFBD> = '<EFBFBD><EFBFBD>' THEN 1 ELSE '0' END
|
|
|
|
|
UPDATE TImpMember SET FBalance = <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
UPDATE TImpMember SET FPoint = <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
UPDATE TImpMember SET FCreateDate =<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
UPDATE TImpMember SET FExpiredDate = <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
|
|
|
|
UPDATE TImpMember SET FBirthday = <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UPDATE TImpMember SET FBirthdayType = 'G'
|
|
|
|
|
|
|
|
|
|
UPDATE A
|
|
|
|
|
SET A.FCardTypeId = B.FId
|
|
|
|
|
FROM TImpMember AS A,TMemberCardType AS B
|
|
|
|
|
WHERE A.<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> = B.FName
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TImpMember WHERE FCompId IS NULL
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TImpMember WHERE <EFBFBD><EFBFBD><EFBFBD><EFBFBD> = 346
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TCompany
|
|
|
|
|
|
|
|
|
|
UPDATE A
|
|
|
|
|
SET A.FCompId = B.FId
|
|
|
|
|
FROM TCompany AS B,TImpMember AS A
|
|
|
|
|
WHERE A.<EFBFBD>쿨<EFBFBD><EFBFBD> = B.FName
|
|
|
|
|
|
|
|
|
|
update TImpMember set FCompId = 5148778370112066439 WHERE <EFBFBD>쿨<EFBFBD><EFBFBD> = '(<EFBFBD>հ<EFBFBD>)'
|
|
|
|
|
update TImpMember set FCompId = 5148778370112066439 WHERE <EFBFBD>쿨<EFBFBD><EFBFBD> = '<EFBFBD><EFBFBD>ó<EFBFBD><EFBFBD>'
|
|
|
|
|
|
|
|
|
|
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) as py,
|
|
|
|
|
0 AS FTypeId,
|
|
|
|
|
FCompId AS FCompId,
|
|
|
|
|
MIN(FCreateDate) AS FCreateDate,
|
|
|
|
|
FGender AS FGender,
|
|
|
|
|
FBirthdayType AS FBirthdayType,
|
|
|
|
|
MIN(FBirthday) AS FBirthday,
|
|
|
|
|
'' AS FTelephone,
|
|
|
|
|
ISNULL(FMobile ,'') as FMobile,
|
|
|
|
|
'' AS FQQ,
|
|
|
|
|
'' AS FWeChat,
|
|
|
|
|
'' AS FIdCard,
|
|
|
|
|
'' AS FEmail,
|
|
|
|
|
'' AS FAddress,
|
|
|
|
|
0 AS FProId,
|
|
|
|
|
'' AS FCPW,
|
|
|
|
|
'' AS FQPW,
|
|
|
|
|
0 AS FChargeEmpId,
|
|
|
|
|
MAX(ISNULL(FPoint,0)) AS FPoint,
|
|
|
|
|
1 AS FRecvConsSMS,
|
|
|
|
|
1 AS FRecvBulkSMS,
|
|
|
|
|
'' AS FMemo,
|
|
|
|
|
'' AS FCustom1,'' AS FCustom2,'' AS FCustom3,'' AS FCustom4,'' AS FCustom5
|
|
|
|
|
|
|
|
|
|
from TImpMember
|
|
|
|
|
where <EFBFBD><EFBFBD>Ա<EFBFBD><EFBFBD><EFBFBD><EFBFBD> is not null
|
|
|
|
|
GROUP BY FMemId,FMemNO,FName,FGender,FMobile ,FCompId, FBirthdayType
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UPDATE TImpMember SET FMemNo = FMemNo + 'A' WHERE FMemId = 6573251781542010627
|
|
|
|
|
UPDATE TImpMember SET FMemNo = FMemNo + 'B' WHERE FMemId = 7896940692748214275
|
|
|
|
|
|
|
|
|
|
UPDATE TImpMember SET FCardNo = FCardNo + 'A' WHERE FCardId = 7036012635993014470
|
|
|
|
|
UPDATE TImpMember SET FCardNo = FCardNo + 'B' WHERE FCardId = 6678266536510439391
|
|
|
|
|
|
|
|
|
|
drop table #Member
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TImpMember WHERE FMobile = '18885176741'
|
|
|
|
|
|
|
|
|
|
UPDATE TImpMember SET FMemId = dbo.FNNewId() WHERE FCardId = 6678266536510439391
|
|
|
|
|
|
|
|
|
|
SELECT FMemNo,SUM(1) FROM #Member
|
|
|
|
|
GROUP BY FMemNo
|
|
|
|
|
|
|
|
|
|
HAVING(SUM(1) > 1)
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TImpMember WHERE FMemNO = '18885176741'
|
|
|
|
|
|
|
|
|
|
SELECT <EFBFBD><EFBFBD><EFBFBD><EFBFBD> FROM TImpMember WHERE FMemNo IS NULL
|
|
|
|
|
|
|
|
|
|
UPDATE A
|
|
|
|
|
SET A.FMemNo = B.FMemNo,
|
|
|
|
|
A.FName = B.FName,
|
|
|
|
|
A.FGender = B.FGender,
|
|
|
|
|
A.FBirthday = B.FBirthday,
|
|
|
|
|
A.FMobile = B.FMobile,
|
|
|
|
|
A.FBirthdayType = B.FBirthdayType,
|
|
|
|
|
A.FMemId = B.FMemId,
|
|
|
|
|
A.FPoint = B.FPoint
|
|
|
|
|
FROM TImpMember AS A,TImpMember AS B
|
|
|
|
|
WHERE B.<EFBFBD><EFBFBD><EFBFBD><EFBFBD> = A.<EFBFBD><EFBFBD><EFBFBD><EFBFBD> - 1
|
|
|
|
|
AND A.FMemNo IS NULL
|
|
|
|
|
|
|
|
|
|
UPDATE TImpMember SET FMemId = dbo.FNNewId()
|
|
|
|
|
|
|
|
|
|
UPDATE A
|
|
|
|
|
SET A.FMobile = B.FMobile
|
|
|
|
|
FROM TImpMember AS A,TImpMember AS B
|
|
|
|
|
WHERE A.FMemId = B.FMemId
|
|
|
|
|
AND A.FMobile IS NULL
|
|
|
|
|
AND B.FMobile is not NULL
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UPDATE A
|
|
|
|
|
SET A.FMemId = B.FMemId,
|
|
|
|
|
A.FCompId = B.FCompId
|
|
|
|
|
FROM TImpMember AS A,(
|
|
|
|
|
|
|
|
|
|
SELECT A.FMemNo,A.FMemId,A.FCompId
|
|
|
|
|
FROM TImpMember AS A,
|
|
|
|
|
(SELECT FMemNo,MIN(<EFBFBD><EFBFBD><EFBFBD><EFBFBD>) AS <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
FROM TImpMember
|
|
|
|
|
GROUP BY FMemNo) AS B
|
|
|
|
|
WHERE A.FMemNO = B.FMemNO
|
|
|
|
|
AND A.<EFBFBD><EFBFBD><EFBFBD><EFBFBD>= B.<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
) AS B
|
|
|
|
|
WHERE A.FMemNo = B.FMemNo
|
|
|
|
|
and A.FMemId != B.FMemId
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TImpMember WHERE FMemNo IS NULL
|
|
|
|
|
SELECT * FROM TImpMember WHERE <EFBFBD><EFBFBD>Ա<EFBFBD><EFBFBD><EFBFBD><EFBFBD> IS NULL
|
|
|
|
|
SELECT * FROM TImpMember WHERE FCardNo IS NULL
|
|
|
|
|
|
|
|
|
|
SELECT A.FMemId FROM TImpMember AS A,TImpMember AS B
|
|
|
|
|
WHERE A.<EFBFBD><EFBFBD><EFBFBD><EFBFBD> = B.<EFBFBD><EFBFBD><EFBFBD><EFBFBD> - 1
|
|
|
|
|
AND B.FMemNo IS NULL
|
|
|
|
|
|
|
|
|
|
select * from TImpMember WHERE <EFBFBD><EFBFBD><EFBFBD><EFBFBD>= '<EFBFBD><EFBFBD>С<EFBFBD><EFBFBD>'
|
|
|
|
|
|
|
|
|
|
DROP TABLE TImpMember
|
|
|
|
|
|
|
|
|
|
DROP TABLE TImpMember
|
|
|
|
|
|
|
|
|
|
EXEC sp_helptext PImportMemberData_Init
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UPDATE TImpMember SET FCardNo = FMemNo WHERE FCardNO IS NULL
|
|
|
|
|
|
|
|
|
|
ALTER TABLE TImpMember ADD FSeq INT IDENTITY
|
|
|
|
|
ALTER TABLE TImpMember ADD FIndex INT
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DROP TABLE #Card
|
|
|
|
|
SELECT FCardNo into #Card
|
|
|
|
|
FROM TImpMember
|
|
|
|
|
|
|
|
|
|
GROUP BY FCardNo
|
|
|
|
|
HAVING(SUM(1)) > 1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UPDATE A
|
|
|
|
|
SET A.FIndex = 1+(SELECT COUNT(1) FROM TImpMember AS B WHERE A.FCardNo = B.FCardNo AND (A.FCreateDate > B.FCreateDate OR (A.FCreateDate = B.FCreateDate AND (A.FSeq > B.FSeq) )))
|
|
|
|
|
FROM TImpMember AS A
|
|
|
|
|
WHERE FCardNo IN(SELECT FCardNO FROM #Card)
|
|
|
|
|
|
|
|
|
|
UPDATE TImpMember SET FCardNo = FCardNo + '' + CASE FIndex WHEN 1 THEN 'A' WHEN 2 THEN 'B' WHEN '3' THEN 'C' END
|
|
|
|
|
WHERE FCardNo IN( SELECT FCardNo FROM #Card)
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TImpMember
|
|
|
|
|
WHERE FCardNo LIKE '%A' OR FCARDNo LIKE '%B'
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TImpMEMBER WHERE FCardNo IN(SELECT FCardNo FROM #Card)
|
|
|
|
|
|
|
|
|
|
UPDATE TIMpMember SET FCardTypeId = (SELECT FId FROM TMemberCardType WHERE FName = 'Ů<EFBFBD><EFBFBD><EFBFBD><EFBFBD>'),
|
|
|
|
|
FCreateDate = '2018-8-24',FExpiredDate = '2021-8-24'
|
|
|
|
|
WHERE FCardid = 9136439626233109675
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TImpMEMBER WHERE FCreateDate IS NULL
|
|
|
|
|
|
|
|
|
|
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(FMemo,'') AS FMemo
|
|
|
|
|
FROM TImpMember
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 TImpMember 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(),'<EFBFBD><EFBFBD>Excel<EFBFBD>е<EFBFBD><EFBFBD><EFBFBD>'
|
|
|
|
|
FROM TImpMember AS A
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|