|
|
use jiaonan_xinjixing
|
|
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TImpMemberCard
|
|
|
|
|
|
SELECT * FROM TImpCardType
|
|
|
|
|
|
|
|
|
|
|
|
ALTER TABLE TImpCardType ADD FId BIGINT
|
|
|
|
|
|
UPDATE TImpCardType SET FId = dbo.FNNewId()
|
|
|
sp_rename 'TImpCardType.FId','FCardTypeId'
|
|
|
|
|
|
INSERT INTO TMemberCardType(FId,FNo,FName,FValueType,FMaterial,FPrice,FCardFeeAmt,FAcctId,FDeposit,FAcctId2,FDeposit2,FAcctId3,FDeposit3,FTimes,FAlertBalance,FMinRchgAmt,FSalePointMode,FSalePointValue,FRchgPointMode,FRchgPointValue,FPaySmsFee,FTimeCard,FValidityPeriod,FValidityPeriodUnit,FExpiredDate,FDefaultMemo,FCreateTime,FAllowSale,FAllowRchg,FDeptId,FEnabled,FOrder)
|
|
|
SELECT FId =FCardTypeId, FCardTypeNo,FCardType,1,FMaterial = 2,0,FCardFeeAmt = 0,FAcctId = 3,FDeposit = 0,FAcctId2 = 0,FDeposit2 = 0 ,FAcctId3 = 0,FDeposit3 = 0,
|
|
|
FTimes = 0,FAlertBalance = 0,FMinRchgAmt = 0,FSalePointMode = 0,FSalePointValue = 0 ,FRchgPointMode = 0,FRchgPointValue = 0,FPaySmsFee = 0,FTimeCard = 0,FValidityPeriod = 100,FValidityPeriodUnit = 1,
|
|
|
FExpiredDate = NULL,FDefaultMemo = '',FCreateTime = GETDATE(),1,1,FDeptId = 0,FEnabled =1,FOrder = 1
|
|
|
FROM TImpCardType
|
|
|
|
|
|
|
|
|
INSERT INTO TMemberCardTypeSub(FId,FCompId,FCardTypeId,FAllowSale,FAllowRchg,FEnabled)
|
|
|
SELECT dbo.FNNewId(),dbo.FNCompId('001'),I.FCardTypeId,1,1,1
|
|
|
FROM TImpCardType AS I
|
|
|
|
|
|
|
|
|
SELECT * FROM TImpMember AS A,TImpMemberCard AS B
|
|
|
WHERE A.FNo = B.FCLientNO
|
|
|
AND A.FName = ''
|
|
|
AND FMoney > 0
|
|
|
|
|
|
|
|
|
SELECT * FROM TImpMember
|
|
|
SELECT * FROM TImpMemberCard
|
|
|
|
|
|
SELECT * FROM TImpMemberCard WHERE FClientNO = '0003'
|
|
|
|
|
|
|
|
|
ALTER TABLE TImpMember ADD FIsLoad BIT NOT NULL DEFAULT 0
|
|
|
|
|
|
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 FState INT
|
|
|
|
|
|
ALTER TABLE TImpMember ADD FBirthday DATETIME
|
|
|
ALTER TABLE TImpMember ADD FBirthdayType CHAR
|
|
|
|
|
|
|
|
|
UPDATE A
|
|
|
SET A.FMobile = ISNULL(B.FMt,''),
|
|
|
-- A.FName = ISNULL(B.FName,A.FName),
|
|
|
A.FGender = CASE WHEN ISNULL(B.FSex,'') = '<EFBFBD><EFBFBD>' THEN 1 ELSE 0 END
|
|
|
FROM TImpMember AS A
|
|
|
LEFT JOIN TImpMemberInfo AS B
|
|
|
ON A.FClientno = B.FNo
|
|
|
|
|
|
select * from TImpMember WHERE FGender IS NULL
|
|
|
|
|
|
|
|
|
SELECT FMemId ,FCardNO,FMemNO,FCardId FROM TImpMember
|
|
|
|
|
|
UPDATE TImpMember SET FMemId = dbo.FNNewId() WHERE FMemId IS NULL
|
|
|
UPDATE TImpMember SET FCardid = dbo.FNNewId() WHERE FCardid IS NULL
|
|
|
UPDATE TImpMember SET FMemNo = FCardNo
|
|
|
|
|
|
UPDATE A
|
|
|
SET A.FCardTypeID = B.FCarDtYPEiD
|
|
|
FROM TImpMember AS A,TImpCardType AS B
|
|
|
WHERE A.FCardTypeNo = B.FCardTypeNo
|
|
|
|
|
|
|
|
|
UPDATE TImpMember SET FBalance = CAST(FMoney AS FLOAT)
|
|
|
WHERE FMoney < 9999998000001.00
|
|
|
|
|
|
UPDATE TImpMember SET FBalance =0
|
|
|
WHERE FMoney >= 9999998000001.00
|
|
|
|
|
|
|
|
|
SELECT * FROM TImpMember
|
|
|
|
|
|
SELECT * FROM TImpMember
|
|
|
ORDER BY FMoney dESC
|
|
|
|
|
|
DELETE TImpMember WHERE FCardState = '<EFBFBD><EFBFBD><EFBFBD><EFBFBD>'
|
|
|
|
|
|
UPDATE TImpMember SET FState = 1 WHERE FCardState = 'ʹ<EFBFBD><EFBFBD>'
|
|
|
UPDATE TImpMember SET FState = 4 WHERE FCardState = '<EFBFBD>ջ<EFBFBD>'
|
|
|
UPDATE TImpMember SET FState = 4 WHERE FCardState = 'ͣ<EFBFBD><EFBFBD>'
|
|
|
UPDATE TImpMember SET FMemo = FNote
|
|
|
UPDATE TImpMember SET FMemo = FMemo + '[<EFBFBD>ջ<EFBFBD>]' WHERE FCardState = '<EFBFBD>ջ<EFBFBD>'
|
|
|
|
|
|
UPDATE TImpMember SET FBirthday = null
|
|
|
UPDATE TImpMember SET FBirthdayType = 'G'
|
|
|
UPDATE TImpMember SET FBirthdayType = 'L'
|
|
|
UPDATE TImpMember SET FName = FMemNo WHERE ISNULL( FName,'') = ''
|
|
|
UPDATE TImpMember SET FCompID = 1
|
|
|
UPDATE TImpMember SET FCreateDate = FBeginDate
|
|
|
UPDATE TImpMember SET FCreateDate = '1900-01-01' WHERE FCreateDate IS NULL
|
|
|
UPDATE TImpMember SET FExpiredDate = FEndDate
|
|
|
|
|
|
UPDATE TImpMember SET FExpiredDate = DATEADD(YEAR,100,FCreateDate ) WHERE FExpiredDate = '1900-01-01 00:00:00.000'
|
|
|
|
|
|
UPDATE A
|
|
|
SET A.FExpiredDate = B.FExpiredDate
|
|
|
FROM TMemberCard AS A,TImpmember AS B
|
|
|
WHERE A.FCardID = B.FCardid
|
|
|
|
|
|
|
|
|
SELECT * FROM TImpMember
|
|
|
ORDER BY FExpiredDate
|
|
|
|
|
|
|
|
|
|
|
|
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,
|
|
|
FCreateDate 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,
|
|
|
0 AS FPoint,
|
|
|
1 AS FRecvConsSMS,
|
|
|
1 AS FRecvBulkSMS,
|
|
|
'' AS FMemo,
|
|
|
'<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵͳ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>' AS FCustom1,'' AS FCustom2,'' AS FCustom3,'' AS FCustom4,'' AS FCustom5
|
|
|
from TImpMember
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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,
|
|
|
FState AS FState,
|
|
|
FCreateDate AS FCreateDate,
|
|
|
DATEADD(year,1, FCreateDate) AS FExpiredDate,
|
|
|
0 AS FTotalTimes,
|
|
|
0 AS FUsedTimes,
|
|
|
FCompId AS FSaleCompId,
|
|
|
0 AS FSaleBillId,
|
|
|
ISNULL(FMemo,'') 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
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
SELECT * FROM TMemberCardType WHERE FNo = '08'
|
|
|
|
|
|
SELECT * FROM TMemberCard WHERE FTypeId = 7454692549301509161
|
|
|
|
|
|
|
|
|
UPDATE A
|
|
|
SET A.FTypeId = B.FId
|
|
|
FROM TMemberCard AS A,TMemberCardType AS B
|
|
|
WHERE A.FCardNo BETWEEN '3305' AND '3339'
|
|
|
AND A.FTypeId = 7454692549301509161
|
|
|
AND B.FNo = '10'
|
|
|
|
|
|
UPDATE A
|
|
|
SET A.FTypeId = B.FId
|
|
|
FROM TMemberCard AS A,TMemberCardType AS B
|
|
|
WHERE A.FCardNo LIKE '3%'
|
|
|
AND A.FTypeId = 7454692549301509161
|
|
|
AND B.FNo = '09'
|
|
|
|
|
|
UPDATE A
|
|
|
SET A.FTypeId = B.FId
|
|
|
FROM TMemberCard AS A,TMemberCardType AS B
|
|
|
WHERE A.FCardNo LIKE '5%'
|
|
|
AND A.FTypeId = 7454692549301509161
|
|
|
AND B.FNo = '09'
|
|
|
|
|
|
UPDATE A
|
|
|
SET A.FTypeId = B.FId
|
|
|
FROM TMemberCard AS A,TMemberCardType AS B
|
|
|
WHERE (A.FCardNo LIKE '6%' OR A.FCardNo LIKE '9%')
|
|
|
AND A.FTypeId = 7454692549301509161
|
|
|
AND B.FNo = '11'
|
|
|
|
|
|
UPDATE A
|
|
|
SET A.FTypeId = B.FId
|
|
|
FROM TMemberCard AS A,TMemberCardType AS B
|
|
|
WHERE (A.FCardNo LIKE '8%' OR A.FCardNo LIKE '8%')
|
|
|
AND A.FTypeId = 7454692549301509161
|
|
|
AND B.FNo = '12'
|
|
|
|
|
|
UPDATE A
|
|
|
SET A.FTypeId = B.FId
|
|
|
FROM TMemberCard AS A,TMemberCardType AS B
|
|
|
WHERE (A.FCardNo LIKE '1%' OR A.FCardNo LIKE '2%')
|
|
|
AND A.FTypeId = 7454692549301509161
|
|
|
AND B.FNo = '10'
|
|
|
|
|
|
UPDATE A
|
|
|
SET A.FCardTypeId = B.FTypeId
|
|
|
FROM TMemberCard AS B,TMemberCardAcctHist AS A
|
|
|
WHERE A.FCardId = B.FCardId
|
|
|
|
|
|
|
|
|
<EFBFBD><EFBFBD><EFBFBD><EFBFBD>3305-3339<EFBFBD><EFBFBD>ͷ<EFBFBD>Ŀ<EFBFBD><EFBFBD><EFBFBD>ת<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ţ<EFBFBD>10
|
|
|
ʣ<EFBFBD><EFBFBD>3<EFBFBD><EFBFBD>ͷ<EFBFBD>Ŀ<EFBFBD><EFBFBD><EFBFBD>ת<EFBFBD><EFBFBD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EFBFBD><EFBFBD>ԭ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>08-<EFBFBD>¿<EFBFBD><EFBFBD>ڵĿ<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
|
|
|
UPDATE A
|
|
|
SET A.FAcctId = (SELECT FId FROM TPayAccount WHERE FNo = '31')
|
|
|
FROM TMemberCardAcctHist AS A,TMemberCard AS B
|
|
|
WHERE B.FCardId = A.FCardId
|
|
|
AND B.FTypeId IN(
|
|
|
|
|
|
SELECT FId FROM TMemberCardType WHERE FNo BETWEEN '01' AND '07'
|
|
|
)
|
|
|
|
|
|
|
|
|
UPDATE TMemberCard SET FEXPIREDDate = '' |