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.

183 lines
5.5 KiB

1 year ago
SELECT REPLACE(<EFBFBD><EFBFBD><EFBFBD><EFBFBD> , 'ũ<EFBFBD><EFBFBD>','9999-') FROM TImpMember
WHERE <EFBFBD><EFBFBD><EFBFBD><EFBFBD> IS NOT NULL
SELECT * FROM TImpMember WHERE <EFBFBD>Ǽ<EFBFBD>ʱ<EFBFBD><EFBFBD> IS NULL
DELETE TImpMember WHERE <EFBFBD><EFBFBD>Ա<EFBFBD><EFBFBD><EFBFBD><EFBFBD> IS NULL
ALTER TABLE TImpMember ADD FCompId BIGINT
SELECT *FROM TCompany
UPDATE TImpMember SET FCompId = 3472336885353807872 WHERE FCompId IS NULL
UPDATE TMemberPhoto SET FChangeid = FChangeId + 1
SELECT M.* FROM TMember AS M,TMemberPhoto AS P
WHERE M.FMemId = P.FMemId
SELECT * FROM TUser
ALTER TABLE TImpMember ADD FIsLoad BIT NOT NULL DEFAULT 0
SELECT <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> FROM TImpMember
GROUP BY <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
ALTER TABLE TImpMember ADD FMemId BIGINT
ALTER TABLE TImpMember ADD FCardNo VARCHAR(50)
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 FCardTypeId BIGINT
ALTER TABLE TImpMember ADD FCourseId BIGINT
ALTER TABLE TImpMember ADD FBalance 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 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
UPDATE TImpMember SET FMemId = dbo.FNNewId() WHERE FMemid IS NULL
UPDATE TImpMember SET FCardId = dbo.FNNewId() WHERE FCardId IS NULL
UPDATE TImpMember SET FCardNo = <EFBFBD><EFBFBD>Ա<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
UPDATE TImpMember SET FMemNo = FCardNo
UPDATE TImpMember SET FName = <EFBFBD><EFBFBD>Ա<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
UPDATE TImpMember SET FMobile = CAST(<EFBFBD> AS BIGINT)
UPDATE TImpMember SET FGender = CASE WHEN <EFBFBD>Ա<EFBFBD> = '<EFBFBD><EFBFBD>' THEN 1 ELSE '0' END
UPDATE TImpMember SET FBalance = <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
UPDATE TImpMember SET FCreateDate = <EFBFBD>Ǽ<EFBFBD>ʱ<EFBFBD><EFBFBD>
UPDATE TImpMember SET FArrear = Ƿ<EFBFBD><EFBFBD>
UPDATE TImpMember SET FMemo = <EFBFBD><EFBFBD>ע
UPDATE TImpMember SET FPoint = Ŀǰ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
UPDATE TImpMember SET FBirthdayType = 'G'
UPDATE TImpMember SET FBirthdayType = 'L' WHERE <EFBFBD><EFBFBD><EFBFBD><EFBFBD> LIKE '<EFBFBD><EFBFBD>%'
UPDATE TImpMember SET FBirthday = REPLACE(REPLACE(<EFBFBD><EFBFBD><EFBFBD><EFBFBD> , 'ũ<EFBFBD><EFBFBD>','9999-') , '<EFBFBD><EFBFBD><EFBFBD><EFBFBD>','9999-')
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 FMemNo IN(SELECT FMemNo FROM TMember)
UPDATE TIMpMember SET FMemNo = FMemNo + '.BY',FCardNO = FCardNo + '.BY'
WHERE FMemNo IN(SELECT FMemNo FROM TMember)
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(FCreateDate ,'1900-01-01') 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,
ISNULL( FPoint,0) 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 TImpMember
INSERT INTO TMemberCard(
FCardId,
FCardNo,
FCardFaceNo,
FTypeId,
FValueType,
FCompId,
FMemId,
FState,
FCreateDate,
FExpiredDate,
FTotalTimes,
FUsedTimes,
FSaleCompId,
FSaleBillId,
FMemo)
SELECT
FCardId AS FId,
FMemno AS FNo,
FMemno AS FFaceNo,
FCardTypeId AS FTypeId,
(SELECT FValueType FROM TMemberCardType WHERE FId = FCardTypeId) AS FValueType,
FCompId AS FCompId,
FMemId AS FMemId,
1 AS FState,
ISNULL(FCreateDate,1900) AS FCreateDate,
DATEADD(year,100, ISNULL(FCreateDate,2000)) AS FExpiredDate,
0 AS FTotalTimes,
0 AS FUsedTimes,
FCompId AS FSaleCompId,
0 AS FSaleBillId,
'' AS FMemo
FROM TImpMember
WHERE FCardTypeId IS NOT NULL
INSERT TMemberCardAccount(FMemId,FId,FCardId,FAcctId,FDeposit,FBalance,FArrear,FCreateDate,FExpiredDate,FMemo)
SELECT FMemId,dbo.FNNewId(),FCardId AS FCardId,3,FBalance,FBalance,0,FCreateDate,DATEADD(year,1, FCreateDate) AS FExpiredDate,''
FROM TImpMember AS A
WHERE FCardTypeId IS NOT NULL
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
WHERE FCardTypeId IS NOT NULL
UPDATE A SET A.FMemo = B.FMemo
FROM TMemberCard AS A,TMember AS B
WHERE A.FMemId = B.FMemId
AND B.FCustom1 = '<EFBFBD>Ӳ<EFBFBD><EFBFBD>е<EFBFBD><EFBFBD><EFBFBD>'
UPDATE B SET B.FMemo = ''
FROM TMemberCard AS A,TMember AS B
WHERE A.FMemId = B.FMemId
AND B.FCustom1 = '<EFBFBD>Ӳ<EFBFBD><EFBFBD>е<EFBFBD><EFBFBD><EFBFBD>'