|
|
|
|
SELECT * FROM TImpMember
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TImpMember ORDER BY <EFBFBD><EFBFBD>Ա<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
WHERE CUSTNO NOT IN (SELECT CUSTNO FROM TImpMember)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
INSERT INTO TMemberCardType(FId,FNo,FName,FValueType,FMaterial,FPrice,FCardFeeAmt,FAcctId,FDeposit,FAcctId2,FDeposit2,
|
|
|
|
|
FAcctId3,FDeposit3,FTimes,FAlertBalance,FPaySmsFee,FTimeCard,FValidityPeriod,FValidityPeriodUnit,FExpiredDate,
|
|
|
|
|
FDefaultMemo,FCreateTime,FAllowSale,FAllowRchg,FEnabled,FOrder,FDeptId)
|
|
|
|
|
SELECT dbo.FNNewId() AS FId,FCardTypeName AS FNo,FCardTypeName AS FName,1 AS ValueType,1 AS FMaterial,0 AS FPrice,0 AS FCardFeeAmt,0 AS FAcctId,0 AS FDeposit,0 AS FAcctId2,0 AS FDeposit2,0 AS FAcctId3,0 AS FDeposit3,0 AS FTimes,0 AS FAlertBalance,0 AS FPaySmsFee,0 AS FTimeCard,0 AS FValidityPeriod,0 AS FValidityPeriodUnit,'' AS FExpiredDate,'' AS FDefaultMemo,'' AS FCreateTime,0 AS FAllowSale,0 AS FAllowRchg,1 AS FEnabled,0 AS FOrder,0 AS FDeptId
|
|
|
|
|
FROM TImpMember
|
|
|
|
|
GROUP BY FCardTypeName
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TMemberCardType
|
|
|
|
|
|
|
|
|
|
UPDATE TMemberCardType SET FSalePointValue = 0,FRchgPointValue = 0 ,FAllowSale=1,FAllowRchg = 1,FMaterial = 2
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 FDeposit DECIMAL(18,6)
|
|
|
|
|
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 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
|
|
|
|
|
ALTER TABLE TImpMember ADD FTotalTimes INT
|
|
|
|
|
ALTER TABLE TImpMember ADD FUsedTimes INT
|
|
|
|
|
ALTER TABLE TImpMember ADD FDeleted BIT
|
|
|
|
|
ALTER TABLE TImpMember ADD FState INT
|
|
|
|
|
|
|
|
|
|
DELETE TImpMember WHERE <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>= '<EFBFBD>ǻ<EFBFBD>Աɢ<EFBFBD><EFBFBD>' OR <EFBFBD><EFBFBD>Ա<EFBFBD><EFBFBD><EFBFBD><EFBFBD> = '<EFBFBD>ϼƣ<EFBFBD>'
|
|
|
|
|
SELECT * FROM TImpMember WHERE <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>= '<EFBFBD>ǻ<EFBFBD>Աɢ<EFBFBD><EFBFBD>' OR <EFBFBD><EFBFBD>Ա<EFBFBD><EFBFBD><EFBFBD><EFBFBD> IS NULL OR <EFBFBD><EFBFBD>Ա<EFBFBD><EFBFBD><EFBFBD><EFBFBD> = '<EFBFBD>ϼƣ<EFBFBD>'
|
|
|
|
|
|
|
|
|
|
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><EFBFBD><EFBFBD>
|
|
|
|
|
UPDATE TImpMember SET FMemo = <EFBFBD><EFBFBD>ַ + ' ' + ϲ<EFBFBD><EFBFBD>
|
|
|
|
|
UPDATE TImpMember SET FCreateDate = <EFBFBD>쿨<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
UPDATE TImpMember SET FExpiredDate = <EFBFBD><EFBFBD>Ч<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
UPDATE TImpMember SET FExpiredDate =DATEADD(YEAR,1000,<EFBFBD>쿨<EFBFBD><EFBFBD><EFBFBD><EFBFBD>) WHERE FExpiredDate IS NULL
|
|
|
|
|
UPDATE TImpMember SET FGender = 0
|
|
|
|
|
UPDATE TImpMember SET FMobile = <EFBFBD>绰
|
|
|
|
|
UPDATE TImpMember SET FName = <EFBFBD><EFBFBD>Ա<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
UPDATE TImpMember SET FMobile = left(<EFBFBD>绰,11) WHERE LEN(<EFBFBD>绰) > 20
|
|
|
|
|
|
|
|
|
|
UPDATE TImpMember SET FBalance = <EFBFBD><EFBFBD>ֵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
UPDATE TImpMember SET FBirthday = <EFBFBD><EFBFBD>Ա<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
UPDATE TImpMember SET FMemNo = FName,FCardNO = FName WHERE FMemNo = ''
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UPDATE TImpMember SET FCardTypeId = (SELECT FId FROM TMemberCardType WHERE FName = '1000Ԫ7<EFBFBD>ۿ<EFBFBD>') WHERE <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>= '1000'
|
|
|
|
|
UPDATE TImpMember SET FCardTypeId = (SELECT FId FROM TMemberCardType WHERE FName = '500Ԫ8<EFBFBD>ۿ<EFBFBD>') WHERE <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>= '500'
|
|
|
|
|
UPDATE TImpMember SET FCardTypeId = (SELECT FId FROM TMemberCardType WHERE FName = '300Ԫ8<EFBFBD>ۼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>') WHERE <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>= '300'
|
|
|
|
|
UPDATE TImpMember SET FCardTypeId = (SELECT FId FROM TMemberCardType WHERE FName = '2000Ԫ6<EFBFBD>ۿ<EFBFBD>') WHERE <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>= '2000'
|
|
|
|
|
UPDATE TImpMember SET FCardTypeId = (SELECT FId FROM TMemberCardType WHERE FName = '3000Ԫ5.5<EFBFBD><EFBFBD>') WHERE <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>= '3000'
|
|
|
|
|
UPDATE TImpMember SET FCardTypeId = (SELECT FId FROM TMemberCardType WHERE FName = '9800Ԫ5<EFBFBD>ۿ<EFBFBD>') WHERE <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>= '9800'
|
|
|
|
|
UPDATE TImpMember SET FCardTypeId = (SELECT FId FROM TMemberCardType WHERE FName = '7000') WHERE <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>= '7000'
|
|
|
|
|
UPDATE TImpMember SET FCardTypeId = (SELECT FId FROM TMemberCardType WHERE FName = '4200') WHERE <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>= '4200'
|
|
|
|
|
UPDATE TImpMember SET FCardTypeId = (SELECT FId FROM TMemberCardType WHERE FName = '1300') WHERE <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>= '1300'
|
|
|
|
|
UPDATE TImpMember SET FCardTypeId = (SELECT FId FROM TMemberCardType WHERE FName = '800') WHERE <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>= '800'
|
|
|
|
|
UPDATE TImpMember SET FCardTypeId = (SELECT FId FROM TMemberCardType WHERE FName = '400') WHERE <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>= '400'
|
|
|
|
|
UPDATE TImpMember SET FCardTypeId = (SELECT FId FROM TMemberCardType WHERE FName = '2800') WHERE <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>= '2800'
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TImpMember WHERE FCardTypeId IS NULL
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TMemberCardType
|
|
|
|
|
|
|
|
|
|
UPDATE T
|
|
|
|
|
|
|
|
|
|
SELECT FMemNo ,SUM(1)
|
|
|
|
|
FROM TImpMember
|
|
|
|
|
GROUP BY FMemNO ORDER BY SUM(1) DESC
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UPDATE TImpMember SET FGender = 0
|
|
|
|
|
|
|
|
|
|
UPDATE TImpMember SET FExpiredDate = DATEADD(YEAR,100,FCreateDate)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TImpMember
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DROP TABLE TImpMember
|
|
|
|
|
|
|
|
|
|
UPDATE TMember SET FMemo = ''
|
|
|
|
|
|
|
|
|
|
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,
|
|
|
|
|
ISNULL(ISNULL(FName,FMobile),FMemNo) AS FName,
|
|
|
|
|
dbo.FNGetFirstPinYin(FName),
|
|
|
|
|
0 AS FTypeId,
|
|
|
|
|
1 AS FCompId,
|
|
|
|
|
FCreateDate AS FCreateDate,
|
|
|
|
|
FGender AS FGender,
|
|
|
|
|
'G' 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,
|
|
|
|
|
'' AS FCustom1,'' AS FCustom2,'' AS FCustom3,'' AS FCustom4,'' AS FCustom5
|
|
|
|
|
from TImpMember
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TImpMember
|
|
|
|
|
WHERE LEN(FMobile) > 20
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
INSERT INTO TMemberCard(
|
|
|
|
|
FCardId,
|
|
|
|
|
FCardNo,
|
|
|
|
|
FCardFaceNo,
|
|
|
|
|
FTypeId,
|
|
|
|
|
FValueType,
|
|
|
|
|
FCompId,
|
|
|
|
|
FMemId,
|
|
|
|
|
FState,
|
|
|
|
|
FCreateDate,
|
|
|
|
|
FExpiredDate,
|
|
|
|
|
FTotalTimes,
|
|
|
|
|
FUsedTimes,
|
|
|
|
|
FSaleCompId,
|
|
|
|
|
FSaleBillId,
|
|
|
|
|
FMemo,FDeleted)
|
|
|
|
|
SELECT
|
|
|
|
|
FCardId AS FId,
|
|
|
|
|
FMemNo AS FNo,
|
|
|
|
|
FMemno AS FFaceNo,
|
|
|
|
|
FCardTypeId AS FTypeId,
|
|
|
|
|
(SELECT FValueType FROM TMemberCardType WHERE FId = FCardTypeId) AS FValueType,
|
|
|
|
|
1 AS FCompId,
|
|
|
|
|
FMemId AS FMemId,
|
|
|
|
|
1 AS FState,
|
|
|
|
|
FCreateDate AS FCreateDate,
|
|
|
|
|
FExpiredDate,
|
|
|
|
|
0 AS FTotalTimes,
|
|
|
|
|
0 AS FUsedTimes,
|
|
|
|
|
1 AS FSaleCompId,
|
|
|
|
|
0 AS FSaleBillId,
|
|
|
|
|
FMemo AS FMemo,0
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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,1,'DR','Import',0,'',A.FBalance,0,A.FBalance,0,getdate(),'<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵͳ<EFBFBD>е<EFBFBD><EFBFBD><EFBFBD>'
|
|
|
|
|
FROM TImpMember AS A
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TImpTransLog WHERE <EFBFBD>ͻ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> = 'A020935'
|
|
|
|
|
|
|
|
|
|
update A
|
|
|
|
|
SET A.FMemId
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TMemberCard WHERE FId = 5494058162892437466
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UPDATE A
|
|
|
|
|
SET A.FExpiredDate = B.FExpiredDate
|
|
|
|
|
FROM TMemberCard AS A,TImpMember AS B
|
|
|
|
|
WHERE A.FCardId = B.FCardId
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TImpMember
|
|
|
|
|
|
|
|
|
|
UPDATE A
|
|
|
|
|
SET A.FMemo = B.Rem
|
|
|
|
|
FROM TMemberCard AS A,TImpMember AS B
|
|
|
|
|
WHERE A.FCardId = B.FCardId
|
|
|
|
|
AND B.Rem IS NOT NULL
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TMemberCardType
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UPDATE TMemberCardType SET FId = FNo + 1000 WHERE FId > 0
|
|
|
|
|
|
|
|
|
|
UPDATE TMemberCard SET FTypeId = 0
|
|
|
|
|
|
|
|
|
|
DELETE TMemberCardTypeSUB
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UPDATE A
|
|
|
|
|
SET A.FTypeId = B.CType + 1000
|
|
|
|
|
FROM TMemberCard AS A,TImpMember AS B
|
|
|
|
|
WHERE A.FCardId = B.FCardId
|
|
|
|
|
|
|
|
|
|
UPDATE TImpMember SET FCardTypeId = CType + 1000
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TMemberCard WHERE FMemo != ''
|
|
|
|
|
|
|
|
|
|
delete TImpMember where CUSTNO IN(SELECT CUSTNO FROM TImpMember2)
|
|
|
|
|
|
|
|
|
|
|