|
|
|
|
|
|
|
|
|
use zhaotong_qinghongdou
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CREATE TABLE TImpCardType
|
|
|
|
|
(
|
|
|
|
|
FCardTypeName VARCHAR(500),
|
|
|
|
|
FCardTypeNo VARCHAR(50),
|
|
|
|
|
FCardTypeId BIGINT
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
drop table TImpCardType
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
select * from TImpCardType
|
|
|
|
|
|
|
|
|
|
DELETE TImpCardType
|
|
|
|
|
|
|
|
|
|
--<EFBFBD><EFBFBD>ֵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
|
|
|
|
INSERT TImpCardType(FCardTypeName,FCardTypeNo,FCardTypeId)
|
|
|
|
|
SELECT <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,DBO.FNNewId()
|
|
|
|
|
from TIMpMemberCard
|
|
|
|
|
group by <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
--<EFBFBD>Ƴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ľ<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
INSERT TImpCardType(FCardTypeName,FCardTypeNo,FCardTypeId)
|
|
|
|
|
SELECT <EFBFBD>ײ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,<EFBFBD>ײ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,DBO.FNNewId()
|
|
|
|
|
from TImpMemberCourse
|
|
|
|
|
WHERE <EFBFBD>ײ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>= '<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'
|
|
|
|
|
group by <EFBFBD>ײ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
|
|
|
|
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,FCardTypeName,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
|
|
|
|
|
|
|
|
|
|
CREATE INDEX IX_IMP_MEMBER_INFO_MEM_ID ON TImpMemberInfo(MemId)
|
|
|
|
|
CREATE INDEX IX_IMP_MEMBER_CARD_MEM_ID ON TImpMemberCard(MemId)
|
|
|
|
|
CREATE INDEX IX_IMP_MEMBER_CARD_CARD_ID ON TImpMemberCard(CardId)
|
|
|
|
|
|
|
|
|
|
ALTER TABLE TImpMemberInfo ADD FMemId BIGINT
|
|
|
|
|
ALTER TABLE TImpMemberInfo ADD FMemNo VARCHAR(50)
|
|
|
|
|
ALTER TABLE TImpMemberInfo ADD FName VARCHAR(50)
|
|
|
|
|
ALTER TABLE TImpMemberInfo ADD FGender INT
|
|
|
|
|
ALTER TABLE TImpMemberInfo ADD FMobile VARCHAR(50)
|
|
|
|
|
ALTER TABLE TImpMemberInfo ADD FBirthdayType VARCHAR(50)
|
|
|
|
|
ALTER TABLE TImpMemberInfo ADD FBirthday DATETIME
|
|
|
|
|
ALTER TABLE TImpMemberInfo ADD FCompId BIGINT
|
|
|
|
|
ALTER TABLE TImpMemberInfo ADD FCreateDate DATETIME
|
|
|
|
|
ALTER TABLE TImpMemberInfo ADD FMemo VARCHAR(MAX)
|
|
|
|
|
|
|
|
|
|
SELECT MemId FROM TImpMemberCard
|
|
|
|
|
GROUP BY MemId
|
|
|
|
|
HAVING SUM(1) > 1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UPDATE TImpMemberInfo SET MemId = '' WHERE MemId IS NULL
|
|
|
|
|
|
|
|
|
|
--<EFBFBD><EFBFBD>Ա<EFBFBD><EFBFBD><EFBFBD><EFBFBD>--<EFBFBD><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD>е<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ļ<EFBFBD>Ա<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
INSERT TImpMemberInfo(<EFBFBD><EFBFBD><EFBFBD><EFBFBD>,ƴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,<EFBFBD>Ա<EFBFBD>,<EFBFBD>ֻ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,<EFBFBD><EFBFBD><EFBFBD>ƺ<EFBFBD>,<EFBFBD><EFBFBD><EFBFBD><EFBFBD>,<EFBFBD>ֿ<EFBFBD><EFBFBD><EFBFBD>,MemId)
|
|
|
|
|
SELECT <EFBFBD><EFBFBD><EFBFBD><EFBFBD>,ƴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,'Ů',<EFBFBD>ֻ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,'','',1,MemId
|
|
|
|
|
FROM TImpMemberCard WITH(NOLOCK)
|
|
|
|
|
WHERE MemId NOT IN(SELECT MemId FROM TImpMemberInfo)
|
|
|
|
|
|
|
|
|
|
UPDATE TImpMemberInfo
|
|
|
|
|
SET FMemId = abs( CAST( CAST(cast(memid as uniqueidentifier) AS BINARY(8)) AS BIGINT))
|
|
|
|
|
|
|
|
|
|
UPDATE TImpMemberInfo
|
|
|
|
|
SET FMemId = dbo.FNNewId()
|
|
|
|
|
WHERE FMemId IS NULL
|
|
|
|
|
|
|
|
|
|
UPDATE A
|
|
|
|
|
SET A.FMemNo = B.<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
FROM TImpMemberInfo AS A,TImpMemberCard AS B
|
|
|
|
|
WHERE A.MemId = B.MemId
|
|
|
|
|
|
|
|
|
|
UPDATE TImpMemberInfo SET FMemNo = <EFBFBD>ֻ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> WHERE FMemNo IS NULL
|
|
|
|
|
|
|
|
|
|
UPDATE A
|
|
|
|
|
SET A.FCreateDate = (SELECT MIN(<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD>) FROM TImpMemberCard AS B WHERE A.MemId = B.MemID)
|
|
|
|
|
FROM TImpMemberInfo AS A
|
|
|
|
|
|
|
|
|
|
UPDATE TImpMemberInfo SET FCreateDate ='1900-01-01'
|
|
|
|
|
WHERE FCreateDate IS NULL
|
|
|
|
|
|
|
|
|
|
UPDATE TImpMemberInfo SET FName = <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
UPDATE TImpMemberInfo SET FMobile = <EFBFBD>ֻ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
UPDATE TImpMemberInfo SET FGender = CASE WHEN <EFBFBD>Ա<EFBFBD> = '<EFBFBD><EFBFBD>' THEN '1' ELSE 0 END
|
|
|
|
|
UPDATE TImpMemberInfo SET FGender = CASE WHEN <EFBFBD>Ա<EFBFBD> = '<EFBFBD><EFBFBD>' THEN '1' ELSE 0 END
|
|
|
|
|
UPDATE TImpMemberInfo SET FBirthdayType = 'G'
|
|
|
|
|
UPDATE TImpMemberInfo SET FBirthdayType = 'L' WHERE <EFBFBD><EFBFBD><EFBFBD><EFBFBD> LIKE '%ũ<EFBFBD><EFBFBD>%'
|
|
|
|
|
UPDATE TImpMemberInfo SET FBirthday = REPLACE(<EFBFBD><EFBFBD><EFBFBD><EFBFBD>,'<EFBFBD><EFBFBD><EFBFBD><EFBFBD>','')
|
|
|
|
|
UPDATE TImpMemberInfo SET FCompId = dbo.FNCompId('001')
|
|
|
|
|
|
|
|
|
|
UPDATE A SET FMemo = B.<EFBFBD><EFBFBD>ע
|
|
|
|
|
FROM TImpMemberCard AS B,TImpMemberInfo AS A
|
|
|
|
|
WHERE <EFBFBD><EFBFBD>ע!= ''
|
|
|
|
|
AND A.MemId = B.MemId
|
|
|
|
|
|
|
|
|
|
SELECT* FROM TImpMemberInfo WHERE FMemId IN(SELECT FMemId FROM TMember)
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TImpMemberInfo_1_2 WHERE FMemID = 1384805588242014283
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TImpMemberCard WHERE FMemId IN(SELECT FMemId 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,
|
|
|
|
|
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,
|
|
|
|
|
ISNULL(FMemo,'') AS FMemo,
|
|
|
|
|
'' AS FCustom1,'' AS FCustom2,'' AS FCustom3,'' AS FCustom4,'' AS FCustom5
|
|
|
|
|
from TImpMemberInfo
|
|
|
|
|
WHERE FMemID NOT IN(SELECT FMemId FROM TMember)
|
|
|
|
|
|
|
|
|
|
SELECT FMemNO FROM TImpMemberInfo
|
|
|
|
|
GROUP BY FMemNO
|
|
|
|
|
HAVING SUM(1 ) > 1
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TImpMemberInfo WHERE FMemNO = '3972504522'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
--<EFBFBD><EFBFBD>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ALTER TABLE TImpMemberCard ADD FBalance DECIMAL(18,6)
|
|
|
|
|
ALTER TABLE TImpMemberCard ADD FBalance2 DECIMAL(18,6)
|
|
|
|
|
ALTER TABLE TImpMemberCard ADD FMemId BIGINT
|
|
|
|
|
ALTER TABLE TImpMemberCard ADD FCardTypeName VARCHAR(100)
|
|
|
|
|
ALTER TABLE TImpMemberCard ADD FCardNo VARCHAR(50)
|
|
|
|
|
ALTER TABLE TImpMemberCard ADD FCardTypeId BIGINT
|
|
|
|
|
ALTER TABLE TImpMemberCard ADD FExpiredDate DATETIME
|
|
|
|
|
ALTER TABLE TImpMemberCard ADD FCreateDate DATETIME
|
|
|
|
|
ALTER TABLE TImpMemberCard ADD FCardId BIGINT
|
|
|
|
|
ALTER TABLE TImpMemberCard ADD FCompId BIGINT
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UPDATE TImpMemberCard SET FExpiredDate = <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD>
|
|
|
|
|
UPDATE TImpMemberCard SET FCreateDate = <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD>
|
|
|
|
|
UPDATE TImpMemberCard SET FCardNo = <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
UPDATE TImpMemberCard SET FCompId = 1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UPDATE TImpMemberCard
|
|
|
|
|
SET FCardID = dbo.FNNewId() WHERE FCardid IS NULL
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UPDATE TImpMemberCard
|
|
|
|
|
SET FMemId = abs( CAST( CAST(cast(memid as uniqueidentifier) AS BINARY(8)) AS BIGINT))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TImpMemberCard WHERE FMemId IS NULL
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UPDATE A
|
|
|
|
|
SET A.FCardTypeId = B.FId
|
|
|
|
|
FROM TImpMemberCard AS A,TMemberCardType AS B
|
|
|
|
|
WHERE A.<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> = B.FName
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UPDATE TImpMemberCard SET FBalance = CAST(ʵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> AS FLOAT)
|
|
|
|
|
UPDATE TImpMemberCard SET FBalance2 = CAST(<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> AS FLOAT)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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,
|
|
|
|
|
'' AS FMemo
|
|
|
|
|
FROM TImpMemberCard
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SELECT FCardNo FROM TImpMemberCard
|
|
|
|
|
GROUP BY FCardnO
|
|
|
|
|
HAVING SUM(1) > 1
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TImpMemberCard
|
|
|
|
|
WHERE FCardnO = '3972505687'
|
|
|
|
|
|
|
|
|
|
delete TImpMemberCard WHERE FCardId = 5994570564907570366
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 TImpMemberCard
|
|
|
|
|
|
|
|
|
|
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><EFBFBD><EFBFBD>ϵͳ<EFBFBD>е<EFBFBD><EFBFBD><EFBFBD>'
|
|
|
|
|
FROM TImpMemberCard AS A
|
|
|
|
|
|
|
|
|
|
INSERT TMemberCardAccount(FMemId,FId,FCardId,FAcctId,FDeposit,FBalance,FArrear,FCreateDate,FExpiredDate,FMemo)
|
|
|
|
|
SELECT FMemId,dbo.FNNewId(),FCardId AS FCardId,10,FBalance2,FBalance2,0,FCreateDate,NULL AS FExpiredDate,''
|
|
|
|
|
FROM TImpMemberCard
|
|
|
|
|
WHERE FBalance2 != 0
|
|
|
|
|
|
|
|
|
|
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,10,getdate(),A.FCardTypeId,A.FCompId,'DR','Import',0,'',A.FBalance2,0,A.FBalance2,0,getdate(),'<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵͳ<EFBFBD>е<EFBFBD><EFBFBD><EFBFBD>'
|
|
|
|
|
FROM TImpMemberCard AS A
|
|
|
|
|
WHERE FBalance2 != 0
|
|
|
|
|
|
|
|
|
|
UPDATE TMemberCard SET FExpiredDate = DATEADD(YEAR,100,FCreateDate )
|
|
|
|
|
WHERE FExpiredDate = '1900-01-01'
|
|
|
|
|
|
|
|
|
|
--<EFBFBD>Ƴ<EFBFBD>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ALTER TABLE TImpMemberCourse ADD FCardState INT
|
|
|
|
|
|
|
|
|
|
ALTER TABLE TImpMemberCourse ADD FMemId BIGINT
|
|
|
|
|
ALTER TABLE TImpMemberCourse ADD FCardTypeId BIGINT
|
|
|
|
|
ALTER TABLE TImpMemberCourse ADD FIsCourse BIT
|
|
|
|
|
ALTER TABLE TImpMemberCourse ADD FCalcMode INT
|
|
|
|
|
ALTER TABLE TImpMemberCourse ADD FBalance DECIMAL(18,6)
|
|
|
|
|
ALTER TABLE TImpMemberCourse ADD FRemainTimes INT
|
|
|
|
|
ALTER TABLE TImpMemberCourse ADD FPurTimes INT
|
|
|
|
|
ALTER TABLE TImpMemberCourse ADD FPurAmount DECIMAL(18,6)
|
|
|
|
|
ALTER TABLE TImpMemberCourse ADD FItemId BIGINT
|
|
|
|
|
ALTER TABLE TImpMemberCourse ADD FCreateDate DATETIME
|
|
|
|
|
ALTER TABLE TImpMemberCourse ADD FExpiredDate DATETIME
|
|
|
|
|
ALTER TABLE TImpMemberCourse ADD FCompId BIGINT
|
|
|
|
|
ALTER TABLE TImpMemberCourse ADD FCardId BIGINT
|
|
|
|
|
ALTER TABLE TImpMemberCourse ADD FMemo VARCHAR(1000)
|
|
|
|
|
ALTER TABLE TImpMemberCourse ADD FArrear DECIMAL(18,6)
|
|
|
|
|
ALTER TABLE TImpMemberCourse ADD FPoint DECIMAL(18,6)
|
|
|
|
|
ALTER TABLE TImpMemberCourse ADD FState INT
|
|
|
|
|
ALTER TABLE TImpMemberCourse ADD FCardNo VARCHAR(1000)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
--<EFBFBD><EFBFBD><EFBFBD>Ƴ<EFBFBD>
|
|
|
|
|
|
|
|
|
|
insert TImpItem
|
|
|
|
|
select <EFBFBD>ײ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> AS FName,dbo.FNNewId() AS FItemId,dbo.FNNewId() AS FCourseId
|
|
|
|
|
INTO TImpItem
|
|
|
|
|
FROM
|
|
|
|
|
TImpMemberCourse
|
|
|
|
|
WHERE <EFBFBD>ײ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> != '<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'
|
|
|
|
|
GROUP BY <EFBFBD>ײ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
INSERT TItem(FId,FNo,FNoOfPad,FName,FAbbr,FTypeId,FBriefCode,FDescription,FPriceMode,FIsService,FStatTimes,FCustom1,FCustom2,FCustom3,FEnabled,FPrice,FVipPrice,FTime,FDctId,FPointMode,FPointValue,FDeptId,FAllowBooking)
|
|
|
|
|
SELECT FItemId,FName,FName,FName,FName,0,dbo.FNGetFirstPinYin(FName),'''',1,1,1,'''','''','''',1,0,0,0,0,0,0,0,1
|
|
|
|
|
FROM TImpItem
|
|
|
|
|
WHERE FItemId NOT IN(SELECT FId FROM TItem)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
INSERT INTO TCourse(FId,FNo,FName,FBriefCode,FItemId,FPackId,FSequence,FTypeId,FTimes,FFreeTimes,FDurable,FValidityPeriodUnit,FValidityPeriod,FCreateDate,FExpiredDate,FDescription,FEnabled,FPrice,FAmount,FCalcMode)
|
|
|
|
|
SELECT FCourseId AS FId,
|
|
|
|
|
A.FName + 'L1',
|
|
|
|
|
A.FName AS FName,
|
|
|
|
|
'' AS FBriefCode,
|
|
|
|
|
A.FItemId AS FItemId,
|
|
|
|
|
0 AS FPackId,
|
|
|
|
|
1 AS FSequence,
|
|
|
|
|
(SELECT TOP 1 FId FROM TBasicType WHERE FKey = 'CourseType') AS FTypeId,
|
|
|
|
|
1 AS FTimes,
|
|
|
|
|
0 AS FFreeTimes,
|
|
|
|
|
0 AS FDurable,
|
|
|
|
|
0 AS FValidityPeriodUnit,
|
|
|
|
|
0 AS FValidityPeriod,
|
|
|
|
|
getdate() AS FCreateDate,
|
|
|
|
|
NULL AS FExpiredDate,
|
|
|
|
|
'' AS FDescription,
|
|
|
|
|
1 AS FEnabled,
|
|
|
|
|
0 AS FPrice,
|
|
|
|
|
0 AS FAmount,
|
|
|
|
|
1 AS FCalcMode
|
|
|
|
|
FROM TImpItem AS A
|
|
|
|
|
WHERE FCourseId NOT IN(SELECT FId FROM TCourse)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UPDATE TImpMemberCourse
|
|
|
|
|
SET FCardId = dbo.FNNewId()
|
|
|
|
|
WHERE FCardId IS NULl
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UPDATE TImpMemberCourse
|
|
|
|
|
SET FCardId = NULL
|
|
|
|
|
|
|
|
|
|
UPDATE TImpMemberCourse
|
|
|
|
|
SET FCardId = dbo.FNNewId() WHERE FCardId IS NULL
|
|
|
|
|
|
|
|
|
|
SELECT CardId,SUM(1)
|
|
|
|
|
FROM TImpMemberCourse
|
|
|
|
|
GROUP BY CardId
|
|
|
|
|
ORDER BY SUM(1) DESC
|
|
|
|
|
|
|
|
|
|
UPDATE TImpMemberCourse SET FCardId = dbo.FNNewId() WHERE FCardId IS NULL
|
|
|
|
|
UPDATE TImpMemberCourse SET FCompId = 1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TImpMemberCourse WHERE <EFBFBD>ײ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> != '<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'
|
|
|
|
|
|
|
|
|
|
UPDATE TImpMemberCourse SET FIsCourse = 0
|
|
|
|
|
UPDATE TImpMemberCourse SET FIsCourse = 1 WHERE <EFBFBD>ײ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> != '<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'
|
|
|
|
|
UPDATE TImpMemberCourse SET FCalcMode = 1 WHERE <EFBFBD>ײ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> = '<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƴ<EFBFBD>'
|
|
|
|
|
UPDATE TImpMemberCourse SET FCalcMode = 2 WHERE <EFBFBD>ײ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> = '<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'
|
|
|
|
|
UPDATE TImpMemberCourse SET FCalcMode = 1 WHERE <EFBFBD>ײ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> = '<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƴ<EFBFBD>'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UPDATE A SET A.FCreateDate = B.<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD>,
|
|
|
|
|
A.FExpiredDate = A.<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD>
|
|
|
|
|
FROM TImpMemberCourse AS A,TImpMEMBERCard AS B
|
|
|
|
|
WHERE A.CardId = B.CardId
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SELECT ״̬ FROM TImpMemberCourse
|
|
|
|
|
GROUP BY ״̬
|
|
|
|
|
|
|
|
|
|
UPDATE TImpMemberCourse SET FState = 1 WHERE ״̬ != '<EFBFBD><EFBFBD><EFBFBD>˿<EFBFBD>'
|
|
|
|
|
UPDATE TImpMemberCourse SET FState = 2 WHERE ״̬ = '<EFBFBD><EFBFBD><EFBFBD>˿<EFBFBD>'
|
|
|
|
|
UPDATE TImpMemberCourse SET FState = 1 WHERE ״̬ = '<EFBFBD>ѵ<EFBFBD><EFBFBD><EFBFBD>'
|
|
|
|
|
|
|
|
|
|
UPDATE A
|
|
|
|
|
SET A.FName = B.FName
|
|
|
|
|
FROM TCourse AS A,TItem AS B
|
|
|
|
|
WHERE A.FItemId = B.FId
|
|
|
|
|
AND B.FNo IN(SELECT <EFBFBD>ײ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> FROM TImpMemberCourse)
|
|
|
|
|
|
|
|
|
|
UPDATE A
|
|
|
|
|
SET A.FCalcMode = B.FCalcMode
|
|
|
|
|
FROM TCourse AS A,TImpMemberCourse AS B,TItem AS I
|
|
|
|
|
WHERE I.FNo = B.<EFBFBD>ײ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
AND I.FId = A.FItemId
|
|
|
|
|
AND B.FIsCourse = 1
|
|
|
|
|
AND I.FId IN(SELECT FItemId FROM TImpItem)
|
|
|
|
|
|
|
|
|
|
--AND <EFBFBD>ײ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> LIKE '%<EFBFBD><EFBFBD>%'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TImpMemberCourse WHERE FIsCourse = 1
|
|
|
|
|
AND FCalcMode = 0
|
|
|
|
|
|
|
|
|
|
UPDATE A
|
|
|
|
|
SET A.FMemId = M.FMemId
|
|
|
|
|
FROM TImpMemberCourse AS A,TImpMemberCard AS B,TImpMemberInfo AS M
|
|
|
|
|
WHERE M.MemId = B.MemId
|
|
|
|
|
AND A.CardId = B.CardId
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UPDATE A
|
|
|
|
|
SET A.FCardTypeId = B.FId,
|
|
|
|
|
A.FItemId = B.FItemId
|
|
|
|
|
FROM TImpMemberCourse AS A,TCourse AS B,TItem AS I,TImpItem_1 AS C
|
|
|
|
|
WHERE A.<EFBFBD>ײ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>= C.FName
|
|
|
|
|
-- AND A.FCalcMode = B.FCalcMode
|
|
|
|
|
AND I.FId = B.FItemId
|
|
|
|
|
AND I.FId = C.FItemId
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- AND <EFBFBD>ײ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> LIKE '%<EFBFBD><EFBFBD>%'
|
|
|
|
|
SELECT * FROM TImpMemberCourse WHERE FCardTypeId IS NULL
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UPDATE TImpMemberCourse SET FRemainTimes = CAST(ʣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> AS FLOAT)
|
|
|
|
|
UPDATE TImpMemberCourse SET FBalance = CAST(ʣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> AS FLOAT)
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TMemberCardType
|
|
|
|
|
|
|
|
|
|
SELECT A.<EFBFBD><EFBFBD><EFBFBD><EFBFBD>,A.<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,A.<EFBFBD>ײ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,A.<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD>, B.<EFBFBD>ײ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,B.<EFBFBD>ײ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,B.ʣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,B.<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD>, CAST(A.<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> AS FLOAT)
|
|
|
|
|
FROM TImpMember AS A,TImpMemberCourse AS B
|
|
|
|
|
WHERE a.<EFBFBD><EFBFBD><EFBFBD><EFBFBD> = B.FCardNo
|
|
|
|
|
AND CAST(<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> AS FLOAT) != 0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ALTER TABLE TImpMemberCourse ALTER COLUMN <EFBFBD><EFBFBD><EFBFBD><EFBFBD> VARCHAR(2000)
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TMemberPhoto
|
|
|
|
|
INSERT TMemberPhoto(FMemId,FType,FImage,FImagePath)
|
|
|
|
|
SELECT FMemId,1,NULL,<EFBFBD><EFBFBD>Ƭ
|
|
|
|
|
FROM TImpMemberInfo
|
|
|
|
|
WHERE <EFBFBD><EFBFBD>Ƭ != ''
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TMemberPhoto
|
|
|
|
|
|
|
|
|
|
UPDATE TImpMemberCourse SET FCompId = dbo.FNCompId('002')
|
|
|
|
|
|
|
|
|
|
UPDATE TImpMemberCourse SET FExpiredDate = nULL WHERE FExpiredDate = '1900-01-01 00:00:00.000' AND FIsCourse = 1
|
|
|
|
|
|
|
|
|
|
INSERT TMemberCourse(FId,FMemId,FCourseId,FMemPackId,FItemId,FCompId,FPurTimes,FPurAmount,FFreeTimes,FFreeAmount,FPurchaseDate,FExpiredDate,FBizType,FTransId,FArrear,FDurable,FMemo,FCalcMode,FAdjustPrice,FState)
|
|
|
|
|
SELECT FCardId,FMemId,FCardTypeId,0,FItemId,FCompId,FRemainTimes,FBalance,0,0,FCreateDate,FExpiredDate,'DR.Import',0,0,0,'<EFBFBD><EFBFBD>ϵͳ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>',FCalcMode,0,FState
|
|
|
|
|
FROM TImpMemberCourse AS A
|
|
|
|
|
WHERE A.FIsCourse = 1
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TCourse WHERE FId = 6416222031751472563
|
|
|
|
|
|
|
|
|
|
-- AND <EFBFBD>ײ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> LIKE '%<EFBFBD><EFBFBD>%'
|
|
|
|
|
|
|
|
|
|
INSERT INTO TMemberCourseLog(FId,FMemId,FCardId,FCourseId,FItemId,FPackId,FTime,FInPurTimes,FInFreeTimes,FOutPurTimes,FOutFreeTimes,FRemainPurTimes,FRemainFreeTimes,FCompId,FBillType,FBizType,FBillId,FBillNo,FBillDetailId,FRecordTime,FMemo)
|
|
|
|
|
SELECT Id = FCardId,MemId = FMemId,CardId = 0,CourseId = FCardTypeId,ItemId = FItemId,PackId = 0,Time = getdate(),InPurTimes = FRemainTimes,InFreeTimes =0,
|
|
|
|
|
OutPurTimes = 0,OutFreeTimes = 0,RemainPurTimes = FRemainTimes,RemainFreeTimes = 0,CompId = FCompId ,BillType = 'DR',BizType = 'Import',BillId = 0,BillNo = '',BillDetailId = 0,RecordTime = getdate(),Memo = '<EFBFBD><EFBFBD>ϵͳ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>'
|
|
|
|
|
FROM TImpMemberCourse AS A
|
|
|
|
|
WHERE A.FIsCourse = 1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UPDATE A
|
|
|
|
|
SET A.FExpiredDate = B.<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD>
|
|
|
|
|
FROM TMemberCard AS A,TImpMemberCourse AS B
|
|
|
|
|
WHERE A.FCardId = B.FCardId
|
|
|
|
|
AND A.FExpiredDate != B.<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD>
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
|
UPDATE TImpMemberCourse SET FCardState = 1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UPDATE TImpMemberCourse SET FIsCourse = 0 WHERE FIsCourse IS NULL
|
|
|
|
|
SELECT * FROM TImpMemberCourse WHERE ISNULL(FIsCourse,0) = 0
|
|
|
|
|
|
|
|
|
|
UPDATE A
|
|
|
|
|
SET A.FCardTypeId = B.FId
|
|
|
|
|
FROM TImpMemberCourse AS A,TMemberCardType AS B
|
|
|
|
|
WHERE A.<EFBFBD>ײ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>= B.FName
|
|
|
|
|
AND FIsCourse = 0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SELECT <EFBFBD>ײ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> FROM TImpMemberCourse
|
|
|
|
|
WHERE FIsCourse = 0
|
|
|
|
|
GROUP BY <EFBFBD>ײ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TImpMember WHERE FCardNo = '288103120'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SELECT CardId,sum(1) FROM TImpMemberCourse WHERE FIsCourse = 0
|
|
|
|
|
AND FBalance != 0
|
|
|
|
|
GROUP BY CardId
|
|
|
|
|
ORDER BY SUM(1) DESC
|
|
|
|
|
|
|
|
|
|
select * from TImpMemberCourse WHERE CardId = 'cf63a311-a63a-4e57-a99b-a54e00e652b7'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DELETE TMemberCardAccount WHERE FBalance = 0
|
|
|
|
|
AND FCardId IN(SELECT FCardId FROM TMemberCard WHERE FCardNo LIKE '%.3')
|
|
|
|
|
|
|
|
|
|
DELETE TMemberCardAcctHist WHERE FCardId NOT IN(SELECT FCardId FROM TMemberCard)
|
|
|
|
|
|
|
|
|
|
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,
|
|
|
|
|
FExpiredDate AS FExpiredDate,
|
|
|
|
|
0 AS FTotalTimes,
|
|
|
|
|
0 AS FUsedTimes,
|
|
|
|
|
FCompId AS FSaleCompId,
|
|
|
|
|
0 AS FSaleBillId,
|
|
|
|
|
'' AS FMemo
|
|
|
|
|
FROM TImpMemberCourse
|
|
|
|
|
-- WHERE FCardTypeId IS NOT NULL
|
|
|
|
|
where FIsCourse = 0
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TImpMemberCourse WHERE FCardTypeId IS NULL
|
|
|
|
|
and FIsCourse = 0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UPDATE TMemberCardType SET FValidityPeriodUnit = 1,FValidityPeriod = 100
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TImpMemberCourse WHERE FIsCourse = 1
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TImpM
|
|
|
|
|
|
|
|
|
|
UPDATE TMemberCardType SET FAllowRchg = 1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 TImpMemberCourse
|
|
|
|
|
WHERE 1=1
|
|
|
|
|
AND FIsCourse = 0
|
|
|
|
|
|
|
|
|
|
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><EFBFBD><EFBFBD>ϵͳ<EFBFBD>е<EFBFBD><EFBFBD><EFBFBD>'
|
|
|
|
|
FROM TImpMemberCourse AS A
|
|
|
|
|
WHERE 1=1
|
|
|
|
|
AND FIsCourse = 0
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TImpMemberCourse WHERE ״̬ = '<EFBFBD><EFBFBD><EFBFBD>˿<EFBFBD>' AND FExpir
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TMemberCard
|
|
|
|
|
|
|
|
|
|
SELECT FCardNO,sum(1)
|
|
|
|
|
FROM TImpMemberCourse
|
|
|
|
|
where FIsCourse = 0
|
|
|
|
|
GROUP BY FCardNO ORDER BY sum(1) DESC
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SELECT * from TImpMemberCourse where FCardNO IN (SELECT FCardNO FROM TMemberCard)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
--<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
UPDATE A
|
|
|
|
|
SET A.FCardNo = B.<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
FROM TImpMemberCourse AS A,TImpMemberCard AS B
|
|
|
|
|
WHERE A.CardId = B.CardId
|
|
|
|
|
|
|
|
|
|
UPDATE TImpMemberCourse
|
|
|
|
|
SET FCardNo = FCardNo + '.1'
|
|
|
|
|
WHERE FCardNo IN(SELECT FCardNo FROM TImpMemberCard)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ALTER TABLE TImpMemberCourse ADD FIndex INT
|
|
|
|
|
ALTER TABLE TImpMemberCourse ADD FSeq INT IDENTITY(1,1) NOT NULL
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UPDATE A
|
|
|
|
|
SET A.FIndex = (SELECT COUNT(1) FROM TImpMemberCourse AS B WHERE B.FCardNo = A.FCardNo AND A.FIsCourse = B.FIsCourse AND B.FSeq > A.FSeq ) + 1
|
|
|
|
|
FROM TImpMemberCourse AS A
|
|
|
|
|
WHERE A.FIsCourse = 0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TImpMemberCourse
|
|
|
|
|
|
|
|
|
|
UPDATE TMemberCard SET FExpiredDate = '9000-01-01' WHERE FExpiredDate = '1900-01-01'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UPDATE TImpMemberCourse SET FCardno = REPLACE(FCardno,'.1','')
|
|
|
|
|
UPDATE TImpMemberCourse SET FCardno = REPLACE(FCardno,'.2','')
|
|
|
|
|
UPDATE TImpMemberCourse SET FCardno = REPLACE(FCardno,'.3','')
|
|
|
|
|
UPDATE TImpMemberCourse SET FCardno = REPLACE(FCardno,'.4','')
|
|
|
|
|
UPDATE TImpMemberCourse SET FCardno = REPLACE(FCardno,'.5','')
|
|
|
|
|
UPDATE TImpMemberCourse SET FCardno = REPLACE(FCardno,'.9','')
|
|
|
|
|
UPDATE TImpMemberCourse SET FCardno = REPLACE(FCardno,'.8','')
|
|
|
|
|
|
|
|
|
|
UPDATE TImpMemberCourse SET FCardno = FCardno + '.' + CAST(Findex AS VARCHAR)
|
|
|
|
|
WHERE FIndex >1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
--<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƴ̴<EFBFBD>ֵ<EFBFBD><EFBFBD>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TImpMember
|
|
|
|
|
|
|
|
|
|
SELECT ʵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> + <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> FROM TImpMember
|
|
|
|
|
WHERE CAST(ʵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> AS FLOAT) + CAST(<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> AS FLOAT) > 0
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TImpMember
|
|
|
|
|
|
|
|
|
|
UPDATE TMemberCardType SET FName ='<EFBFBD>꿨<EFBFBD><EFBFBD>ֵ' WHERE FNo = 'Course'
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UPDATE TMemberCard SET FCardNO = FCardNo + '.8' WHERE FCardNo NOT LIKE '%.%'
|
|
|
|
|
AND FCardNo + '.8' NOT IN(SELECT FCardNO FROM TMemberCard)
|
|
|
|
|
AND FCardId != 0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TMemberCard WHERE FCardNo NOT LIKE '%.%'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
use qingdao_vstar
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TMember WHERE FMobilePhone = '15269218016'
|
|
|
|
|
|
|
|
|
|
UPDATE TMemberCardType SET FMATERIAL = 2
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TMemberCardType
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TImpMemberCourseHist
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TImpMemberCourse
|
|
|
|
|
|
|
|
|
|
UPDATE A
|
|
|
|
|
SET A.FCardNO = B.FCardnO
|
|
|
|
|
from TCOnsumeBill AS A,TMemberCard AS B
|
|
|
|
|
WHERE A.FCardId = B.FCardId
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TImpMemberCourse
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TImpMember WHERE FCardNO = ''
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TImpMember WHERE <EFBFBD><EFBFBD><EFBFBD><EFBFBD> LIKE '%ţ<EFBFBD><EFBFBD>%'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UPDATE TMemberCard SET FExpiredDate = '9000-01-01' WHERE
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UPDATE A
|
|
|
|
|
SET A.FExpiredDate = B.FExpiredDate
|
|
|
|
|
FROM TImpMemberCourse AS B,TMemberCard AS A
|
|
|
|
|
WHERE A.FCardID = b.FCardId
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TMemberCard
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TImpMemberCourseHist
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
select left('m7PhMEYqsWVxMkFlidZ1XKus8ngdp85S3KfaJqU9HGT',32)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ALTER TABLE TImpMemberCourseHist ADD FEmployees VARCHAR(1000)
|
|
|
|
|
ALTER TABLE TImpMemberCourseHist ADD FRemainTimes DECIMAL(18,6)
|
|
|
|
|
ALTER TABLE TImpMemberCourseHist ADD FBillType VARCHAR(1000)
|
|
|
|
|
ALTER TABLE TImpMemberCourseHist ADD FBizType VARCHAR(1000)
|
|
|
|
|
ALTER TABLE TImpMemberCourseHist ADD FId BIGINT
|
|
|
|
|
ALTER TABLE TImpMemberCourseHist ADD FInPurAmount DECIMAL(18,6)
|
|
|
|
|
ALTER TABLE TImpMemberCourseHist ADD FOutPurAmount DECIMAL(18,6)
|
|
|
|
|
ALTER TABLE TImpMemberCourseHist ADD FInPurTimes DECIMAL(18,6)
|
|
|
|
|
ALTER TABLE TImpMemberCourseHist ADD FOutPurTimes DECIMAL(18,6)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UPDATE TImpMemberCourseHist SET FEmployees = <EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ա<EFBFBD><EFBFBD>
|
|
|
|
|
UPDATE TImpMemberCourseHist SET FId = dbo.FNNewId()
|
|
|
|
|
|
|
|
|
|
UPDATE TImpMemberCourseHist SET FBillType = 'DR'
|
|
|
|
|
UPDATE TImpMemberCourseHist SET FBizType =<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
|
|
|
|
UPDATE TImpMemberCourseHist SET FRemainTimes = CAST(<EFBFBD><EFBFBD>ǰ<EFBFBD><EFBFBD><EFBFBD><EFBFBD> AS FLOAT)
|
|
|
|
|
UPDATE TImpMemberCourseHist SET FBillType ='DR_XF' WHERE <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> = '<EFBFBD><EFBFBD><EFBFBD><EFBFBD>'
|
|
|
|
|
UPDATE TImpMemberCourseHist SET FBizType ='DR_Item' WHERE <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> = '<EFBFBD><EFBFBD><EFBFBD><EFBFBD>'
|
|
|
|
|
UPDATE TImpMemberCourseHist SET FBillType ='DR_KK' WHERE <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> = '<EFBFBD><EFBFBD><EFBFBD><EFBFBD>'
|
|
|
|
|
UPDATE TImpMemberCourseHist SET FBizType ='DR_CourseSale' WHERE <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> = '<EFBFBD><EFBFBD><EFBFBD><EFBFBD>'
|
|
|
|
|
|
|
|
|
|
DELETE TMemberCourseLog WHERE FBilltYPE LIKE 'DR%'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TImpMemberCourseHist WHERE <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD> = '2016-10-08 10:14:28'
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TMember WHERE FMemNO = '532106105'
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TImpMemberCourseHist WHERE FMemId = 1630559165388138822
|
|
|
|
|
|
|
|
|
|
UPDATE TImpMemberCourseHist SET FInPurTimes = cast(<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> AS FLOAT) WHERE cast(<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> AS FLOAT) >= 0
|
|
|
|
|
UPDATE TImpMemberCourseHist SET FOutPurTimes = cast(<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> AS FLOAT)WHERE cast(<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> AS FLOAT) < 0
|
|
|
|
|
|
|
|
|
|
UPDATE TImpMemberCourseHist SET FInPurAmount = cast(<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> AS FLOAT) WHERE cast(<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> AS FLOAT) >= 0
|
|
|
|
|
UPDATE TImpMemberCourseHist SET FOutPurAmount = cast(<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> AS FLOAT)WHERE cast(<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> AS FLOAT) < 0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
INSERT INTO TMemberCourseLog(FId,FMemId,FCardId,FCourseId,FItemId,FPackId,FTime,FInPurTimes,FOutPurTimes,FInPurAmount,FOutPurAmount,FInFreeTimes,FOutPurTimes,FOutFreeTimes,FRemainPurTimes,FRemainFreeTimes,FCompId,FBillType,FBizType,FBillId,FBillNo,FBillDetailId,FRecordTime,FMemo,FEmployees)
|
|
|
|
|
SELECT Id = dbo.FNNewId(),MemId = FMemId,CardId = FCardId,CourseId = FCardTypeId,ItemId = FItemId,PackId = 0,Time = <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD>,FInPurTimes,FOutPurTimes,FInPurAmount,FOutPurAmount,InFreeTimes =0,
|
|
|
|
|
OutPurTimes = 0,OutFreeTimes = 0,RemainPurTimes = FRemainTimes,RemainFreeTimes = 0,CompId = FCompId ,BillType = FBillType,BizType = FBizType,BillId = 0,BillNo = '',BillDetailId = 0,RecordTime = getdate(),Memo = '<EFBFBD><EFBFBD>ϵͳ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>',FEmployees
|
|
|
|
|
FROM TImpMemberCourseHist AS A
|
|
|
|
|
WHERE FCardId IN(SELECT FId FROM TMemberCourse)
|
|
|
|
|
|
|
|
|
|
UPDATE A
|
|
|
|
|
SET A.FItemId = B.FId
|
|
|
|
|
FROM TImpMemberCourseHist AS A,TItem AS B
|
|
|
|
|
WHERE A.<EFBFBD><EFBFBD>Ŀ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>= b.fname
|
|
|
|
|
|
|
|
|
|
UPDATE A
|
|
|
|
|
SET A.FItemId = B.FItemid
|
|
|
|
|
FROM TImpMemberCourseHist AS A,TCourse AS B
|
|
|
|
|
WHERE A.FCardTypeId= b.FId
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- AND <EFBFBD>ײ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> LIKE '%<EFBFBD><EFBFBD>%'
|
|
|
|
|
|
|
|
|
|
http://www.bsgrj.com/MemberCard/ConsumeLog?memberId=d249be91-2136-45a9-9a08-a781015453ef
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
--<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʷ
|
|
|
|
|
|
|
|
|
|
ALTER TABLE TImpMemberTransHist ADD FCardId BIGINT
|
|
|
|
|
ALTER TABLE TMemberOldTransHist ALTER COLUMN FEmployee VARCHAR(2000)
|
|
|
|
|
|
|
|
|
|
UPDATE A
|
|
|
|
|
SET A.FCardId = B.FCardId
|
|
|
|
|
FROM TImpMemberCard AS B,TImpMemberTransHist as a
|
|
|
|
|
WHERE A.<EFBFBD><EFBFBD><EFBFBD><EFBFBD>=B.FCardNo
|
|
|
|
|
|
|
|
|
|
UPDATE TImpMemberTransHist SET FCardId = 0 WHERE FCardId IS NULL
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SELECT MAX(LEN(<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ա<EFBFBD><EFBFBD>)) FROM TImpMemberTransHist
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
INSERT TMemberOldTransHist(FId,FCompId,FMemId,FTime,FCardId,FBIllType,FBizType,FTransNo,FCOntent,FPrice,FQuantity,FAmount,FPayment,Femployee,FMemo)
|
|
|
|
|
SELECT dbo.FNNewId(),1,FMemId,ISNULL(<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,'1753-01-01'),FCardId, '' <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, '' <EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ա<EFBFBD><EFBFBD>,ISNULL( <EFBFBD><EFBFBD><EFBFBD>ݺ<EFBFBD>,'') AS FTransNo,
|
|
|
|
|
ISNULL(<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀ,''),<EFBFBD><EFBFBD><EFBFBD><EFBFBD>,1,<EFBFBD><EFBFBD><EFBFBD><EFBFBD>,ISNULL('',''),'', '' AS FMemo
|
|
|
|
|
FROM TImpMemberTransHist WITH(NOLOCK)
|
|
|
|
|
WHERE FMemId IS NOT NULL
|
|
|
|
|
AND FMemId IN(SELECT FMemId FROM TMember)
|
|
|
|
|
|
|
|
|
|
|