|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TCompany
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SELECT count(*) FROM TImpMember WHERE ID NOT IN(SELECT FCardId FROM TImpMemberAcct)
|
|
|
|
|
SELECT * FROM TImpMemberAcct
|
|
|
|
|
WHERE 1=1
|
|
|
|
|
AND intAccountCate != 1
|
|
|
|
|
|
|
|
|
|
AND FCardId = 3257267
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TImpMemberCourse
|
|
|
|
|
WHERE FCardId = 3257267
|
|
|
|
|
|
|
|
|
|
--<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƴ<EFBFBD>
|
|
|
|
|
ALTER TABLE TImpMemberCourse ADD FMemId BIGINT
|
|
|
|
|
ALTER TABLE TImpMemberCourse ADD FCreateDate DATETIME
|
|
|
|
|
ALTER TABLE TImpMemberCourse ADD FExpiredDate DATETIME
|
|
|
|
|
ALTER TABLE TImpMemberCourse ADD FItemId BIGINT
|
|
|
|
|
ALTER TABLE TImpMemberCourse ADD FCardTypeId BIGINT
|
|
|
|
|
ALTER TABLE TImpMemberCourse ADD FCardId BIGINT
|
|
|
|
|
ALTER TABLE TImpMemberCourse ADD FCompId BIGINT
|
|
|
|
|
ALTER TABLE TImpMemberCourse ADD FMemNo BIGINT
|
|
|
|
|
ALTER TABLE TImpMemberCourse ADD FCardTypeName VARCHAR(100)
|
|
|
|
|
ALTER TABLE TImpMemberCourse ADD FPurTimes DECIMAL(18,6)
|
|
|
|
|
ALTER TABLE TImpMemberCourse ADD FUsedPurTimes DECIMAL(18,6)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UPDATE TImpMemberCourse SET FCardTypeName = <EFBFBD><EFBFBD>Ŀ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
|
|
|
|
SELECT FCardTypeName FROM TImpMemberCourse
|
|
|
|
|
GROUP BY FCardTypeName
|
|
|
|
|
|
|
|
|
|
UPDATE A
|
|
|
|
|
SET A.FMemId = B.FMemId
|
|
|
|
|
FROM TImpMemberCourse AS A,TImpMember AS B
|
|
|
|
|
WHERE A.<EFBFBD><EFBFBD><EFBFBD><EFBFBD> = B.<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
|
|
|
|
CREATE TABLE TImpCourse
|
|
|
|
|
(
|
|
|
|
|
FItemId BIGINT,
|
|
|
|
|
FCourseId BIGINT,
|
|
|
|
|
FItemNo VARCHAR(100),
|
|
|
|
|
FItemName VARCHAR(100)
|
|
|
|
|
)
|
|
|
|
|
INSERT TImpCourse(FItemId,FCourseId,FItemNo,FItemName)
|
|
|
|
|
SELECT dbo.FNNewId(),dbo.FNNewId(),FCardTypeName,FCardTypeName
|
|
|
|
|
FROM TImpMemberCourse
|
|
|
|
|
GROUP BY FCardTypeName
|
|
|
|
|
|
|
|
|
|
UPDATE A
|
|
|
|
|
SET A.FId = B.FItemId
|
|
|
|
|
FROM TItem AS A,TImpCourse AS B
|
|
|
|
|
WHERE A.FNo = B.FItemNo
|
|
|
|
|
|
|
|
|
|
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 dbo.FNNewId(),FItemName,FItemName,FItemName,FItemName,0,dbo.FNGetFirstPinYin(FItemName),'',1,1,1,'','','',1,0,0,0,0,0,0,0,1
|
|
|
|
|
FROM TImpCourse
|
|
|
|
|
|
|
|
|
|
INSERT TItemSub(FId,FCompId,FItemId,FPrice,FVipPrice,FTime,FDctId,FPointMode,FPointValue,FDeptId,FAllowBooking,FEnabled)
|
|
|
|
|
SELECT dbo.FNNewId(),C.FId,I.FId,I.FPrice,I.FVipPrice,I.FTime,I.FDctId,I.FPointMode,I.FPointValue,I.FDeptId,I.FAllowBooking,I.FEnabled
|
|
|
|
|
FROM TItem AS I,TCompany AS C
|
|
|
|
|
WHERE I.FId != 0
|
|
|
|
|
AND C.FId = dbo.FNCompId('004')
|
|
|
|
|
AND NOT EXISTS(SELECT TOP 1 1 FROM TItemSub AS B WHERE B.FCompId = C.FId AND B.FItemId = I.FId)
|
|
|
|
|
AND I.FId IN(SELECT FItemId FROM TImpCourse)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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,
|
|
|
|
|
I.FItemName + 'L1',
|
|
|
|
|
I.FItemName ,
|
|
|
|
|
'' AS FBriefCode,
|
|
|
|
|
I.FItemId AS FItemId,
|
|
|
|
|
0 AS FPackId,
|
|
|
|
|
1 AS FSequence,
|
|
|
|
|
0 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 TImpCourse AS I
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UPDATE A
|
|
|
|
|
SET A.FCreateDate = <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,
|
|
|
|
|
A.FExpiredDate = <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
FROM TImpMemberCourse AS A
|
|
|
|
|
|
|
|
|
|
UPDATE A
|
|
|
|
|
SET A.FCardId = dbo.FNnewId()
|
|
|
|
|
FROM TImpMemberCourse AS A
|
|
|
|
|
WHERE A.FCardId IS NULL
|
|
|
|
|
|
|
|
|
|
UPDATE A
|
|
|
|
|
SET A.FItemId = B.FItemId,
|
|
|
|
|
A.FCourseId = B.FCourseId
|
|
|
|
|
FROM TImpCourse AS B,TImpMemberCourse AS A
|
|
|
|
|
WHERE B.FItemName = A.FCardTypeName
|
|
|
|
|
|
|
|
|
|
UPDATE TImpMemberCourse SET FPurTimes = <EFBFBD>ܴ<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
UPDATE TImpMemberCourse SET FUsedPurTimes = FPurTimes - ʣ<EFBFBD><EFBFBD>
|
|
|
|
|
|
|
|
|
|
UPDATE TImpMemberCourse SET FCompId = dbo.FNCompId('004')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TImpError
|
|
|
|
|
|
|
|
|
|
delete TImpError
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TImpMemberCourse
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SELECT *INTO TMember_Exist FROM TMember WHERE FMemNo IN(SELECT CardNo FROM TImpMember)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TImpMember WHERE Credit != 0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TUser
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TImpMember WHERE CardNo = '800128'
|
|
|
|
|
|
|
|
|
|
CREATE TABLE TImpError
|
|
|
|
|
(
|
|
|
|
|
CardId BIGINT,
|
|
|
|
|
Error VARCHAR(7000)
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
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 FBirthday DATETIME
|
|
|
|
|
ALTER TABLE TImpMember ADD FBirthdayType CHAR
|
|
|
|
|
|
|
|
|
|
UPDATE TImpMember SET FCardTypeName = 'DC' + <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
|
|
|
|
DROP TABLE TImpCardType
|
|
|
|
|
GO
|
|
|
|
|
|
|
|
|
|
CREATE TABLE TImpCardType
|
|
|
|
|
(
|
|
|
|
|
FShopId INT ,
|
|
|
|
|
FCardTypeName VARCHAR(500),
|
|
|
|
|
FCardTypeNo VARCHAR(50),
|
|
|
|
|
FCardTypeId BIGINT
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
DELETE TImpMember WHERE <EFBFBD><EFBFBD><EFBFBD><EFBFBD> IS NULL
|
|
|
|
|
|
|
|
|
|
DELETE TImpCardType
|
|
|
|
|
INSERT TImpCardType(FCardTypeId,FCardTypeNo,FCardTypeName)
|
|
|
|
|
SELECT dbo.FNNewId(),
|
|
|
|
|
FCardTypeName ,
|
|
|
|
|
FCardTypeName AS Name
|
|
|
|
|
FROM TImpMember
|
|
|
|
|
GROUP BY FCardTypeName
|
|
|
|
|
ORDER BY FCardTypeName
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TImpCardType
|
|
|
|
|
SELECT * FROM TImpMember WHERE FCardTypeName IS NULL
|
|
|
|
|
|
|
|
|
|
delete TMemberCardType WHERE FId > 111
|
|
|
|
|
|
|
|
|
|
WHERE FId NOT IN(SELECT FCardTypeiD FROM TMemberCardTypeSub)
|
|
|
|
|
AND FId > 11
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TMemberCardType
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
WHERE FCardTypeNo NOT IN(SELECT FNO FROM TMemberCardType)
|
|
|
|
|
ORDER BY FCardTypeName
|
|
|
|
|
|
|
|
|
|
INSERT INTO TMemberCardTypeSub(FId,FCompId,FCardTypeId,FAllowSale,FAllowRchg,FEnabled)
|
|
|
|
|
SELECT dbo.FNNewId(),dbo.FNCompId('004'),I.FCardTypeId,1,1,1
|
|
|
|
|
FROM TImpCardType AS I
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SELECT CardTypeName FROM TImpMember
|
|
|
|
|
WHERE CardTypeName NOT IN(SELECT FCardTypeName FROM TImpCardType)
|
|
|
|
|
GROUP BY CardTypeName
|
|
|
|
|
|
|
|
|
|
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>
|
|
|
|
|
UPDATE TImpMember SET FCardno = <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
UPDATE TImpMember SET FName = <EFBFBD>˿<EFBFBD><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 = CAST(<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> AS FLOAT)
|
|
|
|
|
UPDATE TImpMember SET FBalance2 = CAST(<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> AS FLOAT)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UPDATE TImpMember SET FCreateDate = <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
UPDATE TImpMember SET FExpiredDate = <EFBFBD><EFBFBD>ֹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
UPDATE TImpMember SET FCompId = (SELECT FId FROM TCompany WHERE FNo = '004')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UPDATE TImpMember SET FCardState = 1
|
|
|
|
|
|
|
|
|
|
--<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
|
|
|
|
UPDATE TImpMember SET FBirthday = NULL
|
|
|
|
|
UPDATE TImpMember SET FBirthday = <EFBFBD><EFBFBD><EFBFBD><EFBFBD> WHERE <EFBFBD><EFBFBD><EFBFBD><EFBFBD> != '1900/1/1 0:00:00'
|
|
|
|
|
|
|
|
|
|
UPDATE TImpMember SET FBirthdayType = 'G'
|
|
|
|
|
UPDATE TImpMember SET FBirthdayType = 'L' WHERE IsCNBirth = 1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ALTER TABLE TImpMember ADD FBirthdayStr VARCHAR(10)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UPDATE TImpMember SET FBirthdayStr = '' WHERE FBirthdayStr = '9999-02-30'AND FBirthdayType = 'G'
|
|
|
|
|
|
|
|
|
|
UPDATE TImpMember SET FBirthdayStr = '9996-02-29'
|
|
|
|
|
WHERE 1=1
|
|
|
|
|
AND FBirthdayStr LIKE '%02-29' OR FBirthdayStr LIKE
|
|
|
|
|
AND FBirthdayType = 'L'
|
|
|
|
|
|
|
|
|
|
SELECT FBirthdayStr FROM TImpMember WHERE FBirthdayStr LIKE '___-__-__'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UPDATE TImpMember SET FBirthdayStr = '9999' + SUBSTRING(FBirthdayStr,4,6) WHERE FBirthdayStr LIKE '___-__-__'
|
|
|
|
|
|
|
|
|
|
SELECT FBirthdayStr ,FBirthdayType
|
|
|
|
|
,CAST(FBirthdayStr AS DATETIME)
|
|
|
|
|
FROM TImpMember
|
|
|
|
|
WHERE 1=1
|
|
|
|
|
AND LEN(FBirthdayStr) = 10
|
|
|
|
|
AND FBirthdayStr > '9999-02-28'
|
|
|
|
|
AND FBirthdayStr != ''
|
|
|
|
|
ORDER BY FBirthdayStr ASC
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SELECT FBirthdayStr FROM TImpMember
|
|
|
|
|
|
|
|
|
|
UPDATE TImpMember SET FBirthday = FBirthdayStr
|
|
|
|
|
WHERE LEN(FBirthdayStr) = 10
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SELECT Birth FROM TImpMember
|
|
|
|
|
WHERE LEN(Birth) = 10
|
|
|
|
|
AND Birth NOT LIKE '00%'
|
|
|
|
|
|
|
|
|
|
SELECT Birth FROM TImpMember
|
|
|
|
|
|
|
|
|
|
--״̬
|
|
|
|
|
UPDATE TMemberCardAccount SET FExpiredDate = null
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TImpMember WHERE StatusReason NOT IN('<EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<EFBFBD><EFBFBD>ʧ','<EFBFBD><EFBFBD><EFBFBD><EFBFBD>')
|
|
|
|
|
|
|
|
|
|
UPDATE TImpMember SET FCardState = 1 WHERE StatusReason = '<EFBFBD><EFBFBD><EFBFBD><EFBFBD>'
|
|
|
|
|
UPDATE TImpMember SET FCardState = 1 WHERE StatusReason = '<EFBFBD><EFBFBD><EFBFBD><EFBFBD>'
|
|
|
|
|
UPDATE TImpMember SET FCardState = 16 WHERE StatusReason = '<EFBFBD><EFBFBD>ʧ'
|
|
|
|
|
UPDATE TImpMember SET FCardState = 1 WHERE StatusReason = '<EFBFBD><EFBFBD><EFBFBD><EFBFBD>'
|
|
|
|
|
|
|
|
|
|
SELECT FCardnO,fnAME, FMobile,FBalance,StatusReason FROM TImpMember WHERE FCardNo = '6011238'
|
|
|
|
|
|
|
|
|
|
UPDATE TImpMember SET F
|
|
|
|
|
|
|
|
|
|
--<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
UPDATE A
|
|
|
|
|
SET A.FCardTypeName = CardTypeName + '[' +CAST(Discount * CAST(10.0 AS FLOAT) AS VARCHAR) + '<EFBFBD><EFBFBD>]'
|
|
|
|
|
FROM TImpMember AS A
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UPDATE A SET A.FCardTypeId = B.FCardTypeId
|
|
|
|
|
FROM TImpMember AS A,TImpCardType AS B
|
|
|
|
|
WHERE A.FCardTypeName = B.FCardTypeName
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SELECT FCardTypeName FROM TImpMember
|
|
|
|
|
WHERE FCardTypeId IS NULL
|
|
|
|
|
GROUP BY FCardTypeName
|
|
|
|
|
|
|
|
|
|
--<EFBFBD>ظ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
|
|
|
|
UPDATE A
|
|
|
|
|
SELECT FMemNo,SUM(1) FROM TIMpMEMBER
|
|
|
|
|
GROUP BY FMemNo
|
|
|
|
|
ORDER BY SUM(1) DESC
|
|
|
|
|
|
|
|
|
|
SELECT FCardnO,SUM(1) FROM TIMpMEMBER
|
|
|
|
|
GROUP BY FCardnO
|
|
|
|
|
ORDER BY SUM(1) DESC
|
|
|
|
|
|
|
|
|
|
SELECT FMemId,SUM(1) FROM TIMpMEMBER
|
|
|
|
|
GROUP BY FMemId
|
|
|
|
|
ORDER BY SUM(1) DESC
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TIMpMEMBER WHERE FMemID = 189072
|
|
|
|
|
|
|
|
|
|
SELECT CardnO,MemberCode FROM TImpMember WHERE FCardNo != FMemNo
|
|
|
|
|
AND FCompId = dbo.FNCompId('001')
|
|
|
|
|
|
|
|
|
|
DELETE TImpCardType
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TImpMember WHERE MemberID = 189072
|
|
|
|
|
SELECT * FROM TImpMember WHERE MemberCode = '00004'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TImpMember WHERE Balance > '9'
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TImpMember
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TCompany
|
|
|
|
|
SELECT ShopName,ShopId,FCompId FROM TImpMember
|
|
|
|
|
GROUP BY ShopName,FCompId,ShopId
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TImpShopInfo
|
|
|
|
|
|
|
|
|
|
GROUP BY CardTypeId,CardTypeName
|
|
|
|
|
|
|
|
|
|
UPDATE
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SELECT A.CardTypeName,B.FNo,B.FId FROM TImpMember AS A,TMemberCardType AS B
|
|
|
|
|
WHERE A.CardTypeName NOT IN(SELECT FCardTypeName FROM TImpCardType)
|
|
|
|
|
AND A.CardTypeName = B.FName
|
|
|
|
|
GROUP BY A.CardTypeName,B.FNo,B.FId
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UPDATE TMemberCard SET FExpiredDate = '9000-01-01'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TMemberCardType WHERE FName LIKE '%<EFBFBD><EFBFBD><EFBFBD><EFBFBD>%'
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TUser
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
--<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʷ
|
|
|
|
|
SELECT * FROM TImpMemberLog
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ALTER TABLE TImpMemberLog ADD FMemId BIGINT
|
|
|
|
|
ALTER TABLE TImpMemberLog ADD FBillNo VARCHAR(50)
|
|
|
|
|
ALTER TABLE TImpMemberLog ADD FBizType VARCHAR(50)
|
|
|
|
|
ALTER TABLE TImpMemberLog ADD FContent VARCHAR(1000)
|
|
|
|
|
ALTER TABLE TImpMemberLog ADD FAmount DECIMAL(18,6)
|
|
|
|
|
ALTER TABLE TImpMemberLog ADD FTime DATETIME
|
|
|
|
|
ALTER TABLE TImpMemberLog ADD FId VARCHAR(50)
|
|
|
|
|
ALTER TABLE TImpMemberLog ADD FEmployee VARCHAR(1000)
|
|
|
|
|
ALTER TABLE TImpMemberLog ADD FQuantity DECIMAL(18,6)
|
|
|
|
|
ALTER TABLE TImpMemberLog ADD FCompId BIGINT
|
|
|
|
|
|
|
|
|
|
UPDATE A
|
|
|
|
|
SET A.FMemId = M.FMemId
|
|
|
|
|
FROM TImpMemberLog AS A,TMember AS M
|
|
|
|
|
WHERE A.<EFBFBD><EFBFBD>Ա<EFBFBD><EFBFBD><EFBFBD><EFBFBD> = M.FMemNo
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TImpMemberAcctHist
|
|
|
|
|
|
|
|
|
|
UPDATE TImpMemberLog SET FBillNo = <EFBFBD><EFBFBD><EFBFBD>ݺ<EFBFBD>
|
|
|
|
|
UPDATE TImpMemberLog SET FContent = <EFBFBD><EFBFBD>Ŀ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
UPDATE TImpMemberLog SET FQuantity = <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
UPDATE TImpMemberLog SET FAmount = <EFBFBD>ۿ۽<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
UPDATE TImpMemberLog SET FEmployee = ISNULL(<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ա<EFBFBD><EFBFBD>,'')
|
|
|
|
|
UPDATE TImpMemberLog SET FTime = <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
UPDATE TImpMemberLog SET FQuantity = <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
UPDATE TImpMemberLog SET FId = dbo.FNNewId()
|
|
|
|
|
UPDATE TImpMemberLog SET FCompId = (SELECT FId FROM TCompany WHERE FNo = '003')
|
|
|
|
|
|
|
|
|
|
UPDATE TImpMember SET FMemNO = 'A' + FMemNo,FCardnO = 'A' + FCardNo
|
|
|
|
|
WHERE FMemNo IN(SELECT FMemNo FROM TMember)
|
|
|
|
|
|
|
|
|
|
SELECT FMemNo FROM TImpMember
|
|
|
|
|
GROUP BY FMemNo
|
|
|
|
|
HAVING(SUM(1)) > 1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
WHERE FMemNO IN(SELECT FMemNO FROM TMember)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SELECT FMemId,sum(1)
|
|
|
|
|
FROM TImpMember
|
|
|
|
|
GRoup by FMemId
|
|
|
|
|
order by sum(1) desc
|
|
|
|
|
|
|
|
|
|
AND FMemId IN(SELECT FMemId FROM TMember)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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,
|
|
|
|
|
FCardState 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
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
INSERT TMemberCardAccount(FMemId,FId,FCardId,FAcctId,FDeposit,FBalance,FArrear,FCreateDate,FExpiredDate,FMemo)
|
|
|
|
|
SELECT FMemId,dbo.FNNewId(),FCardId AS FCardId,10,FBalance2,FBalance2,0,FCreateDate,DATEADD(year,1, FCreateDate) AS FExpiredDate,''
|
|
|
|
|
FROM TImpMember AS A
|
|
|
|
|
WHERE FCardTypeId IS NOT NULL
|
|
|
|
|
AND 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>Excel<EFBFBD>е<EFBFBD><EFBFBD><EFBFBD>'
|
|
|
|
|
FROM TImpMember AS A
|
|
|
|
|
WHERE FCardTypeId IS NOT NULL
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
INSERT TMemberCourse(FId,FMemId,FCourseId,FMemPackId,FItemId,FCompId,FPurTimes,FUsedPurTimes,FPurAmount,FFreeTimes,FFreeAmount,FPurchaseDate,FExpiredDate,FBizType,FTransId,FArrear,FDurable,FMemo,FCalcMode,FAdjustPrice)
|
|
|
|
|
SELECT FCardId,FMemId,FCourseId,0,FItemId,FCompId,FPurTimes,FUsedPurTimes,0,0,0,FCreateDate,FExpiredDate,'DR.Import',0,0,0,'ͼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',1,0
|
|
|
|
|
FROM TImpMemberCourse AS A
|
|
|
|
|
|
|
|
|
|
UPDATE TPAYAccount SET FId = 10 WHERE FNo = 'B'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UPDATE TMemberCourseImportEx SET FId = dbo.FNNewId()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
INSERT INTO TMemberCourseHist(FId,FMemId,FMemCourseId,FPackId,FCourseId,FTime,FPurTimes,FFreeTimes,FUsePurTimes,FUseFreeTimes,
|
|
|
|
|
FPurAmount,FFreeAmount,FUsePurAmount,FUseFreeAmount,FCompId,
|
|
|
|
|
FBillType,FBizType,FTransId,FTransNo,FTransDetailId)
|
|
|
|
|
|
|
|
|
|
SELECT dbo.FNNewId(),FMemId,FMemCourseId,0,FCourseId,FTime = getdate(),0,0,0,0,
|
|
|
|
|
0,0,0,0,1,
|
|
|
|
|
'DR','Import',0,'',0
|
|
|
|
|
FROM TImpMemberCourse AS A
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TMember WHERE FMemId IN(SELECT FMemId FROM TMemberCOurse)
|
|
|
|
|
|
|
|
|
|
SELECT FMemId,MIN(FId) FROM TMemberCourse
|
|
|
|
|
GROUP BY FMemId
|
|
|
|
|
|
|
|
|
|
DELETE TMemberCOurse WHERE FId NOT IN( SELECT MIN(FId) FROM TMemberCourse
|
|
|
|
|
GROUP BY FMemId)
|
|
|
|
|
|
|
|
|
|
UPDATE TImpMember SET FIsLOAD = 0
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TImpMemberLog
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TImpMember WHERE FCardNO = '6011238'
|
|
|
|
|
|
|
|
|
|
SELECT
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
INSERT TMemberOldTransHist(FId,FMemId,FTime,FCardId,FCompId,FBillType,FBizType,FTransNo,FContent,FPrice,FQuantity,FAmount,FPayment,FEmployee,FMemo)
|
|
|
|
|
SELECT A.FId,A.FMemId,A.FTime,0,A.FCompId,'DR','Import',FBillNo,FContent,FAmount,FQuantity,FAmount,'',FEmployee,''
|
|
|
|
|
FROM TImpMemberAcctHist AS A
|
|
|
|
|
WHERE ISNULL(FMemId,0) != 0
|
|
|
|
|
AND <EFBFBD><EFBFBD>Ա<EFBFBD><EFBFBD><EFBFBD><EFBFBD> != ''
|
|
|
|
|
|
|
|
|
|
WHERE A.FNo = hykh
|
|
|
|
|
|
|
|
|
|
delete TImpError
|
|
|
|
|
|
|
|
|
|
ALTER TABLE TImpMemberAcctHist ADD FCompId BIGINT
|
|
|
|
|
ALTER TABLE TImpMemberAcctHist ADD FShopId BIGINT
|
|
|
|
|
ALTER TABLE TImpMemberAcctHist ADD FMemId BIGINT
|
|
|
|
|
|
|
|
|
|
UPDATE A
|
|
|
|
|
SET A.FMemId = B.FMemId
|
|
|
|
|
FROM TImpMemberAcctHist AS A,TImpMEMBER AS B
|
|
|
|
|
WHERE A.FCardId = B.FCardId
|
|
|
|
|
|
|
|
|
|
UPDATE A
|
|
|
|
|
SET A.FShopId = B.ShopId
|
|
|
|
|
FROM TImpMember AS B,TImpMemberAcctHist AS A
|
|
|
|
|
WHERE A.vhrShopName = B.ShopName
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UPDATE TImpMemberAcctHist SET FCompId = dbo.FNCompId('001') WHERE fShopId = 697
|
|
|
|
|
UPDATE TImpMemberAcctHist SET FCompId = dbo.FNCompId('002') WHERE fShopId = 784
|
|
|
|
|
UPDATE TImpMemberAcctHist SET FCompId = dbo.FNCompId('003') WHERE fShopId = 805
|
|
|
|
|
UPDATE TImpMemberAcctHist SET FCompId = dbo.FNCompId('004') WHERE fShopId = 3330
|
|
|
|
|
|
|
|
|
|
INSERT INTO TMemberCardOldAcctHist(FId,FMemId,FCardId,FAcctId,FTime,FCardTypeId,FCompId,FBizType,FTransNo,FInAmount,FOutAmount,FBalance,FArrear,FRecordTime,FMemo)
|
|
|
|
|
SELECT intId,FMemId,FCardId,3,ISNULL(dtmOPDateTime,'1753-01-01'),0,ISNULL(FCompId,0),vhrdatatype,vhrBillCode,cast(decinmoney as float),cast(decoutmoney as float),0,0,dtmOPDateTime,vhrdatatype
|
|
|
|
|
FROM TImpMemberAcctHist
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TImpMemberAcctHist WHERE FCompiD IS NULL
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TMemberCard WHERE FCardId = 38677
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TImpMember WHERE CardNo = '8010735'
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TImpError WHERE CardId = 38677
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SELECT
|
|
|
|
|
|
|
|
|
|
|