|
|
|
|
use jinan_xiu
|
|
|
|
|
|
|
|
|
|
drop table TImpMember
|
|
|
|
|
drop table TImpMemberCard
|
|
|
|
|
|
|
|
|
|
SELECT COUNT(1) FROM TImpMemberCard
|
|
|
|
|
SELECT COUNT(1) FROM TImpMember
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TImpMember
|
|
|
|
|
SELECT * FROM TImpMemberCard
|
|
|
|
|
|
|
|
|
|
UPDATE TImpMember SET <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><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>= <EFBFBD><EFBFBD><EFBFBD>˻<EFBFBD><EFBFBD><EFBFBD>Ϣ
|
|
|
|
|
where <EFBFBD><EFBFBD>ǰ<EFBFBD><EFBFBD><EFBFBD><EFBFBD> like '%<EFBFBD><EFBFBD>%'
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TImpMember where <EFBFBD><EFBFBD>ǰ<EFBFBD><EFBFBD><EFBFBD><EFBFBD> like '%<EFBFBD><EFBFBD>%'
|
|
|
|
|
|
|
|
|
|
SELECT MemId,SUM(1)
|
|
|
|
|
FROM TImpMemberCard
|
|
|
|
|
GROUP BY MemId
|
|
|
|
|
HAVING(SUM(1)) > 1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DROP TABLE TImpCardType
|
|
|
|
|
CREATE TABLE TImpCardType
|
|
|
|
|
(
|
|
|
|
|
FId BIGINT,
|
|
|
|
|
FNo VARCHAR(30),
|
|
|
|
|
FName VARCHAR(30),
|
|
|
|
|
FType VARCHAR(30),
|
|
|
|
|
FValueType INT
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
ALTER TABLE TImpMemberCard ADD FCardTypeName VARCHAR(100)
|
|
|
|
|
|
|
|
|
|
ALTER TABLE TImpMember ADD FMemId BIGINT
|
|
|
|
|
ALTER TABLE TImpMemberCard ADD FMemId BIGINT
|
|
|
|
|
ALTER TABLE TImpMemberCard 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 FCreateDate DATETIME
|
|
|
|
|
|
|
|
|
|
ALTER TABLE TImpMemberCard ADD FCardTypeId BIGINT
|
|
|
|
|
ALTER TABLE TImpMemberCard ADD FCourseId BIGINT
|
|
|
|
|
ALTER TABLE TImpMemberCard ADD FBalance DECIMAL(18,6)
|
|
|
|
|
ALTER TABLE TImpMemberCard ADD FBalance2 DECIMAL(18,6)
|
|
|
|
|
ALTER TABLE TImpMemberCard ADD FRemainTimes INT
|
|
|
|
|
ALTER TABLE TImpMemberCard ADD FPurTimes INT
|
|
|
|
|
ALTER TABLE TImpMemberCard ADD FPurAmount DECIMAL(18,6)
|
|
|
|
|
ALTER TABLE TImpMemberCard ADD FItemId BIGINT
|
|
|
|
|
ALTER TABLE TImpMemberCard ADD FCreateDate DATETIME
|
|
|
|
|
ALTER TABLE TImpMemberCard ADD FExpiredDate DATETIME
|
|
|
|
|
ALTER TABLE TImpMember ADD FCompId BIGINT
|
|
|
|
|
ALTER TABLE TImpMemberCard ADD FCompId BIGINT
|
|
|
|
|
ALTER TABLE TImpMemberCard ADD FCardId BIGINT
|
|
|
|
|
ALTER TABLE TImpMember ADD FMemo VARCHAR(1000)
|
|
|
|
|
ALTER TABLE TImpMemberCard 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 FCustom1 VARCHAR(100)
|
|
|
|
|
ALTER TABLE TImpMember ADD FPointText VARCHAR(100)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ALTER TABLE TImpMemberCoursePack ADD FCardTypeId BIGINT
|
|
|
|
|
ALTER TABLE TImpMemberCoursePack ADD FItemId BIGINT
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ALTER TABLE TImpMemberCoursePack ADD FRemainTimes INT
|
|
|
|
|
ALTER TABLE TImpMemberCoursePack ADD FPurTimes INT
|
|
|
|
|
ALTER TABLE TImpMemberCoursePack ADD FUsedTimes INT
|
|
|
|
|
ALTER TABLE TImpMemberCoursePack ADD FPurAmount DECIMAL(18,6)
|
|
|
|
|
|
|
|
|
|
ALTER TABLE TImpMemberCoursePack ADD FCreateDate DATETIME
|
|
|
|
|
ALTER TABLE TImpMemberCoursePack ADD FExpiredDate DATETIME
|
|
|
|
|
|
|
|
|
|
ALTER TABLE TImpMemberCoursePack ADD FCompId BIGINT
|
|
|
|
|
ALTER TABLE TImpMemberCoursePack ADD FCardId BIGINT
|
|
|
|
|
ALTER TABLE TImpMemberCoursePack ADD FMemId BIGINT
|
|
|
|
|
ALTER TABLE TImpMemberCoursePack ADD FMemo VARCHAR(1000)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TImpMemberCoursePack
|
|
|
|
|
--<EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
UPDATE TImpMemberCard SET FCardTYpeName = <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> + '[' + <EFBFBD>ۿ<EFBFBD> + '<EFBFBD><EFBFBD>]'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DELETE TImpCardType
|
|
|
|
|
INSERT TImpCardType(FId,FNo,FName,FValueType)
|
|
|
|
|
SELECT dbo.FNNewId(),FCardTYpeName as fno,FCardTYpeName ,CASE WHEN CASE WHEN <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> = '<EFBFBD>ƴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' THEN '<EFBFBD>ƴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' ELSE '<EFBFBD><EFBFBD>ֵ<EFBFBD><EFBFBD>' END = '<EFBFBD>ƴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' THEN 3 ELSE 1 END
|
|
|
|
|
FROM TImpMemberCard
|
|
|
|
|
WHERE <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> IS NOT NULL
|
|
|
|
|
AND <EFBFBD><EFBFBD><EFBFBD><EFBFBD> IS NOT NULL
|
|
|
|
|
GROUP BY FCardTYpeName ,CASE WHEN <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> = '<EFBFBD>ƴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' THEN '<EFBFBD>ƴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' ELSE '<EFBFBD><EFBFBD>ֵ<EFBFBD><EFBFBD>' END
|
|
|
|
|
ORDER BY FCardTYpeName
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TImpCardType WHERE FNo = '300<EFBFBD>꿨[0<EFBFBD><EFBFBD>]'
|
|
|
|
|
SELECT * FROM TImpMemberCard WHERE FCardTYpeName = '300<EFBFBD>꿨[0<EFBFBD><EFBFBD>]'
|
|
|
|
|
|
|
|
|
|
300<EFBFBD>꿨[0<EFBFBD><EFBFBD>]
|
|
|
|
|
300<EFBFBD>꿨[10<EFBFBD><EFBFBD>]
|
|
|
|
|
300<EFBFBD>꿨[5<EFBFBD><EFBFBD>]
|
|
|
|
|
300<EFBFBD>꿨[0<EFBFBD><EFBFBD>]
|
|
|
|
|
|
|
|
|
|
SELECT FNo FROM TImpCardType
|
|
|
|
|
GROUP BY FNo
|
|
|
|
|
HAVING(SUM(1) > 1)
|
|
|
|
|
|
|
|
|
|
--<EFBFBD><EFBFBD>ԱID
|
|
|
|
|
UPDATE TImpMember SET FMemId = MemId
|
|
|
|
|
UPDATE TImpMemberCard SET FMemId = MemId
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
--<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
UPDATE TImpMember SET FCreateDate = ע<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
|
|
|
|
UPDATE A
|
|
|
|
|
SET A.FCreateDate = B.FCreateDate
|
|
|
|
|
FROM TImpMemberCard AS A,TImpMember AS B
|
|
|
|
|
WHERE A.MemId = B.MemId
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UPDATE TImpMemberCard SET FExpiredDate = ʧЧ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
UPDATE TImpMemberCard SET FExpiredDate = DATEADD(YEAR,100,FCreateDate) WHERE FExpiredDate = '1900-01-01'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
--<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
UPDATE TImpMemberCard SET FCardNo = <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
|
|
|
|
--<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ظ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
DROP TABLE #Card
|
|
|
|
|
|
|
|
|
|
SELECT FCardNo into #Card
|
|
|
|
|
FROM TImpMemberCard
|
|
|
|
|
GROUP BY FCardNo
|
|
|
|
|
HAVING(SUM(1)) > 1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ALTER TABLE TImpMemberCard ADD FSeq INT IDENTITY
|
|
|
|
|
ALTER TABLE TImpMemberCard ADD FIndex INT
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TImpMember WHERE MemId = '59611655'
|
|
|
|
|
SELECT * FROM TImpMember WHERE <EFBFBD>ֻ<EFBFBD><EFBFBD><EFBFBD> = '18635134050'
|
|
|
|
|
|
|
|
|
|
UPDATE A
|
|
|
|
|
SET A.FIndex = 1+(SELECT COUNT(1) FROM TImpMemberCard AS B WHERE A.FCardNo = B.FCardNo AND (A.FCreateDate > B.FCreateDate OR (A.FCreateDate = B.FCreateDate AND (A.FSeq > B.FSeq) )))
|
|
|
|
|
FROM TImpMemberCard AS A
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TImpMemberCard WHERE FCardNo IN(SELECT FCardNO FROM #Card)
|
|
|
|
|
AND FIndex > 0
|
|
|
|
|
|
|
|
|
|
order by FCardNo
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
--ɾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȫһ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
DELETE A
|
|
|
|
|
FROM TImpMemberCard AS A,
|
|
|
|
|
(
|
|
|
|
|
SELECT MemId,CardId,MIN(FSeq) AS FSeq
|
|
|
|
|
FROM TImpMemberCard
|
|
|
|
|
WHERE FCardNO iN(SELECT FCardNo FROM #Card)
|
|
|
|
|
GROUP BY MemId,CardId
|
|
|
|
|
HAVING(SUM(1)>1)
|
|
|
|
|
) AS B
|
|
|
|
|
WHERE A.MemId = B.MemId
|
|
|
|
|
AND A.CardId = B.CardId
|
|
|
|
|
AND A.FSeq = B.FSeq
|
|
|
|
|
|
|
|
|
|
--<EFBFBD>ظ<EFBFBD><EFBFBD>Ļ<EFBFBD>Ա<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
|
|
|
|
SELECT FMemNo into #Card
|
|
|
|
|
FROM TImpMember
|
|
|
|
|
GROUP BY FMemNo
|
|
|
|
|
HAVING(SUM(1)) > 1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ALTER TABLE TImpMember ADD FSeq INT IDENTITY
|
|
|
|
|
ALTER TABLE TImpMember ADD FIndex INT
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UPDATE A
|
|
|
|
|
SET A.FIndex = 1+(SELECT COUNT(1) FROM TImpMember AS B WHERE A.FMemNo = B.FMemNo AND (A.FCreateDate > B.FCreateDate OR (A.FCreateDate = B.FCreateDate AND (A.FSeq > B.FSeq) )))
|
|
|
|
|
FROM TImpMember AS A
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TImpMember WHERE FMemNo IN(SELECT FMemNo FROM #Card)
|
|
|
|
|
AND FIndex > 0
|
|
|
|
|
|
|
|
|
|
order by FMemNo
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UPDATE TImpMember SET FMemNo = FMemNo + '.' + CAST(FIndex AS VARCHAR)
|
|
|
|
|
WHERE FMemNo IN( SELECT FMemNo FROM #Card)
|
|
|
|
|
AND FIndex >= 1
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
UPDATE A
|
|
|
|
|
SET A.FCardNo = B.FCardNo
|
|
|
|
|
FROM TImpMemberCard AS A,TImpMemberCard AS B
|
|
|
|
|
WHERE A.FMemId = B.FMemId
|
|
|
|
|
AND A.FIndex > 1
|
|
|
|
|
AND B.FIndex = 1
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
SELECT FCardNo,SUM(1) AS Cnt FROM TImpMemberCard
|
|
|
|
|
GROUP BY FCardNo
|
|
|
|
|
ORDER BY SUM(1) DESC
|
|
|
|
|
|
|
|
|
|
SELECT FMemNo,FMobile,SUM(1) AS Cnt FROM TImpMember
|
|
|
|
|
GROUP BY FMemNo ,FMobile
|
|
|
|
|
ORDER BY SUM(1) DESC
|
|
|
|
|
|
|
|
|
|
SELECT FMemNo,SUM(1) AS Cnt FROM TImpMember
|
|
|
|
|
WHERE FMemId IN(SELECT FMemId FROM TImpMemberCard)
|
|
|
|
|
GROUP BY FMemNo
|
|
|
|
|
ORDER BY SUM(1) DESC
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TImpMember WHERE FMemNo = '15103405980'
|
|
|
|
|
SELECT * FROM TImpMemberCard WHERE FMemId = '45294303'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UPDATE TImpMemberCard SET FCardId = CardId
|
|
|
|
|
UPDATE TImpMemberCard SET FCardId = dbo.FNNewId() WHERE FCardId IS NULL
|
|
|
|
|
|
|
|
|
|
--<EFBFBD><EFBFBD>Ա<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
UPDATE A
|
|
|
|
|
SET A.FMemNo = B.FCardNo
|
|
|
|
|
FROM TImpMember AS A,TImpMemberCard AS B
|
|
|
|
|
WHERE A.MemId = B.MemId
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UPDATE TImpMember SET FMemNo = <EFBFBD>ֻ<EFBFBD><EFBFBD><EFBFBD> WHERE ISNULL(FMemNo,'') = ''
|
|
|
|
|
|
|
|
|
|
UPDATE TImpMember SET FName = <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
UPDATE TImpMember SET FMobile = <EFBFBD>ֻ<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
UPDATE TImpMember SET FGender = CASE WHEN <EFBFBD>Ա<EFBFBD> = '<EFBFBD><EFBFBD>' THEN 1 ELSE '0' END
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UPDATE TImpMember SET FArrear = 0
|
|
|
|
|
UPDATE TImpMember SET FMemo = FMemo
|
|
|
|
|
|
|
|
|
|
UPDATE TImpMember SET FPointText = replace(replace(replace(replace(<EFBFBD><EFBFBD>ǰ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>,'<EFBFBD><EFBFBD>',''),char(10),''),char(13),''),' ','')
|
|
|
|
|
UPDATE TImpMember SET FPoint = CAST(FPointText AS FLOAT)
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TImpMember where <EFBFBD><EFBFBD>ǰ<EFBFBD><EFBFBD><EFBFBD><EFBFBD> like '%<EFBFBD><EFBFBD>%'
|
|
|
|
|
|
|
|
|
|
SELECT FCompName FROM TImpMember
|
|
|
|
|
GROUP BY FCompName
|
|
|
|
|
|
|
|
|
|
--<EFBFBD>ŵ<EFBFBD>
|
|
|
|
|
UPDATE TImpMember SET FCompId = (SELECT FId FROM TCompany WHERE FName = 'ŵ<EFBFBD><EFBFBD><EFBFBD>۾<EFBFBD><EFBFBD><EFBFBD>·<EFBFBD><EFBFBD>') WHERE FCompName = 'ŵ<EFBFBD><EFBFBD><EFBFBD>۾<EFBFBD><EFBFBD><EFBFBD>·<EFBFBD><EFBFBD>'
|
|
|
|
|
UPDATE TImpMember SET FCompId = (SELECT FId FROM TCompany WHERE FName = 'ŵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ΰ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>') WHERE FCompName = 'ŵ<EFBFBD><EFBFBD><EFBFBD>ۼô<EFBFBD>·<EFBFBD><EFBFBD>'
|
|
|
|
|
UPDATE TImpMember SET FCompId = (SELECT FId FROM TCompany WHERE FName = 'K-vogue<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>') WHERE FCompName = '<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>͵<EFBFBD>'
|
|
|
|
|
|
|
|
|
|
UPDATE TImpMemberCard SET FCompId = dbo.FNCompId('001')
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TCompany
|
|
|
|
|
|
|
|
|
|
UPDATE TImpMemberCard SET FCardNo = 'NA' + FCardNo
|
|
|
|
|
WHERE FCardNo IN(SELECT FCardNo FROM TMemberCard)
|
|
|
|
|
AND FCompId = dbo.FNCompId('011')
|
|
|
|
|
UPDATE TImpMemberCard SET FCardNo = 'NB' + FCardNo
|
|
|
|
|
WHERE FCardNo IN(SELECT FCardNo FROM TMemberCard)
|
|
|
|
|
AND FCompId = dbo.FNCompId('012')
|
|
|
|
|
UPDATE TImpMemberCard SET FCardNo = 'NC' + FCardNo
|
|
|
|
|
WHERE FCardNo IN(SELECT FCardNo FROM TMemberCard)
|
|
|
|
|
AND FCompId = dbo.FNCompId('013')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UPDATE TImpMember SET FMemNo = 'NA' + FMemNo
|
|
|
|
|
WHERE FMemNo IN(SELECT FMemNo FROM TMember)
|
|
|
|
|
AND FCompId = dbo.FNCompId('011')
|
|
|
|
|
UPDATE TImpMember SET FMemNo = 'NB' + FMemNo
|
|
|
|
|
WHERE FMemNo IN(SELECT FMemNo FROM TMember)
|
|
|
|
|
AND FCompId = dbo.FNCompId('012')
|
|
|
|
|
UPDATE TImpMember SET FMemNo = 'NC' + FMemNo
|
|
|
|
|
WHERE FMemNo IN(SELECT FMemNo FROM TMember )
|
|
|
|
|
AND FCompId = dbo.FNCompId('013')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UPDATE A
|
|
|
|
|
SET A.FCompId = B.FCompID
|
|
|
|
|
FROM TImpMemberCard AS A,TImpMember AS B
|
|
|
|
|
WHERE A.FMemId = B.FMemId
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TImpMember WHERE FCardTypeID IS NULL
|
|
|
|
|
|
|
|
|
|
UPDATE A
|
|
|
|
|
SET A.FCardTypeId = B.FId
|
|
|
|
|
FROM TImpMemberCard AS A,TImpCardType AS B
|
|
|
|
|
WHERE A.FCardTypeName= B.FName
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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-')
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TImpMemberCard WHERE FMemo IS NULL
|
|
|
|
|
|
|
|
|
|
--<EFBFBD>ŵ<EFBFBD>
|
|
|
|
|
UPDATE TImpMember SET FCompId = 4700258612397082011
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
|
<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UPDATE TImpMemberCard SET FRemainTimes = REPLACE(SUBSTRING(<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,CHARINDEX('<EFBFBD><EFBFBD>:',<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) + 2,LEN(<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)),'<EFBFBD><EFBFBD>','')
|
|
|
|
|
FROM TImpMember WHERE <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> = '<EFBFBD>ƴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TImpMemberCard WHERE <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> not in( '<EFBFBD>ƴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UPDATE TImpMemberCard SET FBalance = CAST(
|
|
|
|
|
REPLACE( REPLACE(REPLACE(REPLACE(LEFT(<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,CHARINDEX('Ԫ',<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)),'Ԫ',''),' ','') ,char(10),''),' ','')
|
|
|
|
|
AS float)
|
|
|
|
|
WHERE <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> IS NOT NULL
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SELECT <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> FROM TImpMemberCard
|
|
|
|
|
|
|
|
|
|
--<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
ALTER TABLE TImpMemberCard ADD FBalance2Text VARCHAR(10)
|
|
|
|
|
UPDATE TImpMemberCard SET FBalance2Text = CAST(REPLACE( REPLACE(REPLACE(REPLACE(LEFT(<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,CHARINDEX('Ԫ',<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) + 3),'Ԫ',''),' ','') ,char(10),''),' ','')
|
|
|
|
|
AS varchar)
|
|
|
|
|
|
|
|
|
|
select * from TImpMemberCard WHERE FBalance2Text != '0'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UPDATE TImpMemberCard SET FBalance2 = CAST(REPLACE( REPLACE(REPLACE(REPLACE(LEFT(<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,CHARINDEX('Ԫ',<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) + 3),'Ԫ',''),' ','') ,char(10),''),' ','')
|
|
|
|
|
AS float)
|
|
|
|
|
--WHERE <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> NOT LIKE '%<EFBFBD>ײ<EFBFBD>%'
|
|
|
|
|
----------
|
|
|
|
|
|
|
|
|
|
SELECT SUM(CAST(REPLACE( REPLACE(REPLACE(REPLACE(LEFT(<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,CHARINDEX('Ԫ',<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) + 3),'Ԫ',''),' ','') ,char(10),''),' ','')
|
|
|
|
|
AS float) ) FROM TImpMemberCard
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TImpMember WHERE FMemno = '10839'
|
|
|
|
|
|
|
|
|
|
UPDATE TImpCardType SET FNo = 'N' + FNo
|
|
|
|
|
|
|
|
|
|
delete TMemberCardType WHERE FId > 100
|
|
|
|
|
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 ,FNo,FName,FValueType,2,0,0,3,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
|
|
|
|
FROM TImpCardType
|
|
|
|
|
--WHERE FNo IN(SELECT FNo FROM TMemberCardType)
|
|
|
|
|
ORDER BY FNo
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UPDATE TMemberCardType SET FAllowRchg = 1 WHERE FId IN(SELECT FId FROM TImpCardType)
|
|
|
|
|
UPDATE TMemberCardType SET FAllowSale = 1 WHERE FId IN(SELECT FId FROM TImpCardType)
|
|
|
|
|
UPDATE TMemberCardType SET FEnabled = 1 WHERE FId IN(SELECT FId FROM TImpCardType)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
INSERT INTO TMemberCardTypeSub(FId,FCompId,FCardTypeId,FAllowSale,FAllowRchg,FEnabled)
|
|
|
|
|
SELECT dbo.FNNewId(),C.FId,I.FId,FAllowSale,FAllowRchg,FEnabled
|
|
|
|
|
FROM TMemberCardType AS I,TCompany AS C
|
|
|
|
|
WHERE I. FId IN(SELECT FId FROM TImpCardType)
|
|
|
|
|
AND C.FNo IN('011','012','013')
|
|
|
|
|
AND NOT EXISTS(SELECT TOP 1 1 FROM TMemberCardTypeSub AS B WHERE B.FCompId = C.FId AND B.FCardTypeId = I.FId)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TMemberCardType
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TCompany
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DELETE TImpCardType WHERE FId = 7976813579673386319
|
|
|
|
|
DELETE TImpCardType WHERE FId = 9112300963023479389
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TImpMember WHERE <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>= '<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>꿨'
|
|
|
|
|
SELECT * FROM TImpMember WHERE <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>= ''
|
|
|
|
|
SELECT * FROM TImpCardType WHERE FNo = '<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>꿨'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UPDATE TImpMember SET <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> = 'δ֪' WHERE <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> = ''
|
|
|
|
|
UPDATE TImpCardType SET FNo = 'δ֪' ,FName = 'δ֪' WHERE FNo = ''
|
|
|
|
|
|
|
|
|
|
UPDATE TMemberCardType SET FMaterial = 2
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TMemberCardType
|
|
|
|
|
|
|
|
|
|
UPDATE A
|
|
|
|
|
SET A.FValueType = 3
|
|
|
|
|
FROM TMemberCardType AS A,TImpCardType AS B
|
|
|
|
|
WHERE A.FId = B.FId
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
--<EFBFBD>ײ<EFBFBD>
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TImpMemberCoursePack
|
|
|
|
|
|
|
|
|
|
UPDATE TImpMemberCoursePack SET FCardId = dbo.FNNewId() WHERE FCardId IS NULL
|
|
|
|
|
UPDATE TImpMemberCoursePack SET FExpiredDate = NULL
|
|
|
|
|
UPDATE TImpMemberCoursePack SET FExpiredDate = ʧЧ<EFBFBD><EFBFBD><EFBFBD><EFBFBD> WHERE ʧЧ<EFBFBD><EFBFBD><EFBFBD><EFBFBD> != ''
|
|
|
|
|
UPDATE TImpMemberCoursePack SET FMemo = ''
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UPDATE A
|
|
|
|
|
SET A.FItemId = B.FItemId,
|
|
|
|
|
A.FCardTypeId = B.FId
|
|
|
|
|
FROM TImpMemberCoursePack AS A,TCourse AS B
|
|
|
|
|
WHERE A.<EFBFBD><EFBFBD>Ŀ<EFBFBD><EFBFBD><EFBFBD><EFBFBD> = B.FName
|
|
|
|
|
|
|
|
|
|
UPDATE TImpMemberCoursePack SET FRemainTimes = ʣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
UPDATE TImpMemberCoursePack SET FPurTimes = REPLACE(<EFBFBD>ܴ<EFBFBD><EFBFBD><EFBFBD>,'<EFBFBD><EFBFBD>','')
|
|
|
|
|
UPDATE TImpMemberCoursePack SET FPurAmount = <EFBFBD><EFBFBD>ֵ<EFBFBD>ܶ<EFBFBD>
|
|
|
|
|
UPDATE TImpMemberCoursePack SET FUsedTimes = FPurTimes - FRemainTimes
|
|
|
|
|
|
|
|
|
|
UPDATE A
|
|
|
|
|
SET A.FCreateDate = B.FCreateDate,
|
|
|
|
|
A.FMemId = B.FMemId
|
|
|
|
|
FROM TImpMemberCoursePack AS A,TImpMemberCard AS B
|
|
|
|
|
WHERE A.CardId = B.CardId
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TImpMemberCoursePack WHERE FCardTYPEID IS NULL
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UPDATE TImpMemberCoursePack SET FCompId = dbo.FNCompId('001')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DROP TABLE TImpMemberCoursePack
|
|
|
|
|
|
|
|
|
|
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('','') AS FMemo,
|
|
|
|
|
'' AS FCustom1,'' AS FCustom2,'' AS FCustom3,'' AS FCustom4,'' AS FCustom5
|
|
|
|
|
from TImpMember
|
|
|
|
|
|
|
|
|
|
WHERE FMemId IN(SELECT FMemId FROM TImpMemberCard)
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TImpMember WHERE FMemNo = 'NB0000'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SELECT FMemNO FROM TImpMember
|
|
|
|
|
GROUP BY FMemNO
|
|
|
|
|
HAVING(SUM(1) > 1)
|
|
|
|
|
|
|
|
|
|
SELECT FCardNo FROM TImpMemberCard
|
|
|
|
|
GROUP BY FCardNo
|
|
|
|
|
HAVING(SUM(1) > 1)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TImpMember WHERE FMemNo IN(SELECT FMemNo FROM TMember )
|
|
|
|
|
|
|
|
|
|
UPDATE TImpMemberCard SET FCardNo = 'NA'
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TCompany
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TImpMember
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
SELECT * FROM TImpMember
|
|
|
|
|
WHERE FMemId IN(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SELECT FMemId,FMemNo,FName,FMobile,FGender,FCompId ,FBirthdayType ,FBirthday,FCreateDate,FPoint
|
|
|
|
|
INTO #Temp
|
|
|
|
|
FROM TImpMember
|
|
|
|
|
GROUP BY FMemId,FMemNo,FName,FMobile,FGender,FCompId ,FBirthdayType ,FBirthday,FCreateDate,FPoint
|
|
|
|
|
ORDER BY SUM(1) DESC
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
SELECT FMemId
|
|
|
|
|
FROM #Temp
|
|
|
|
|
GROUP BY FMemId
|
|
|
|
|
HAVING(SUM(1)) > 1
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TImpmEMBER WHERE FMemId = 25006217
|
|
|
|
|
|
|
|
|
|
UPDATE TImpMember SET FMemNo = '0000330' WHERE FMemId = 25463627
|
|
|
|
|
UPDATE TImpMember SET FMemNo = '0000055' WHERE FMemId = 25006217
|
|
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
INSERT INTO TMemberCard(
|
|
|
|
|
FCardId,
|
|
|
|
|
FCardNo,
|
|
|
|
|
FCardFaceNo,
|
|
|
|
|
FTypeId,
|
|
|
|
|
FValueType,
|
|
|
|
|
FCompId,
|
|
|
|
|
FMemId,
|
|
|
|
|
FState,
|
|
|
|
|
FCreateDate,
|
|
|
|
|
FExpiredDate,
|
|
|
|
|
FTotalTimes,
|
|
|
|
|
FUsedTimes,
|
|
|
|
|
FSaleCompId,
|
|
|
|
|
FSaleBillId,
|
|
|
|
|
FMemo)
|
|
|
|
|
SELECT
|
|
|
|
|
FCardId AS FId,
|
|
|
|
|
FCardNo AS FNo,
|
|
|
|
|
FCardNo AS FFaceNo,
|
|
|
|
|
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,
|
|
|
|
|
ISNULL(FRemainTimes,0) AS FTotalTimes,
|
|
|
|
|
0 AS FUsedTimes,
|
|
|
|
|
FCompId AS FSaleCompId,
|
|
|
|
|
0 AS FSaleBillId,
|
|
|
|
|
ISNULL(FMemo,'') AS FMemo
|
|
|
|
|
FROM TImpMemberCard
|
|
|
|
|
WHERE FCardTypeName IS NOT NULL
|
|
|
|
|
|
|
|
|
|
UPDATE TImpMemberCard SET FCardId = dbo.FNNewId()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TImpMember WHERE FCardId IS NULL
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
WHERE CardNo 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,NULL AS FExpiredDate,''
|
|
|
|
|
FROM TImpMemberCard 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>ʢ<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 AS A
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
--<EFBFBD>Ƴ<EFBFBD>
|
|
|
|
|
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,FCardTypeId,0,FItemId,FCompId,FPurTimes,FPurTimes-FRemainTimes,FPurAmount,0,0,FCreateDate,FExpiredDate,'DR.Import',0,0,0,'<EFBFBD><EFBFBD>ʢ<EFBFBD><EFBFBD><EFBFBD>е<EFBFBD><EFBFBD><EFBFBD>',1,0
|
|
|
|
|
FROM TImpMemberCoursePack AS A
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
INSERT INTO TMemberCourseLog(FId,FMemId,FCardId,FPackId,FCourseId,FTime,FInPurTimes,FInFreeTimes,FOutPurTimes,FOutFreeTimes,FCompId,FBillType,FBizType,FBillId,FBillNo,FBillDetailId,FRecordTime)
|
|
|
|
|
SELECT dbo.FNNewId(),FMemId,A.FCardId AS FCardId,0, ISNULL(FCardTypeId,0),getdate(),FPurTimes,0,FPurTimes-FRemainTimes,0,FCompId,'DR','Import',0,'',0,getdate()
|
|
|
|
|
FROM TImpMemberCoursePack AS A
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TImpMember WHERE FBalance2!= 0
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TImpMember AS A
|
|
|
|
|
WHERE FBalance2 != 0
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TImpTransHist
|
|
|
|
|
|
|
|
|
|
ALTER TABLE TImpTransHist ADD FCompId BIGINT
|
|
|
|
|
ALTER TABLE TImpTransHist ADD FTime DATETIME
|
|
|
|
|
|
|
|
|
|
UPDATE TImpTransHIst SET FtIME = REPLACE(Time,'<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڣ<EFBFBD>','')
|
|
|
|
|
UPDATE TImpTransHist SET FCompID = DBO.FNCompId('011')
|
|
|
|
|
|
|
|
|
|
UPDATE
|
|
|
|
|
SELECT * FROM TImpTransHist
|
|
|
|
|
|
|
|
|
|
INSERT TMemberOldTransHist(FId,FCompId,FMemId,FTime,FCardId,FBIllType,FBizType,FTransNo,FCOntent,FPrice,FQuantity,FAmount,FPayment,Femployee,FMemo)
|
|
|
|
|
SELECT dbo.FNNewId(),FCompId,MemId,FTime,CardId,'',BizType,BillNo,
|
|
|
|
|
ISNULL(Content,''),0,1,0,Amount,Employee, Memo AS FMemo
|
|
|
|
|
FROM TImpTransHist
|
|
|
|
|
|
|
|
|
|
WHERE FMemId IS NOT NULL
|
|
|
|
|
AND FMemId IN(SELECT FMemId FROM TImpMember3)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TCompany
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TMemberCard WHERE FMemo != ''
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TImpMember where isnull(FMemo,'') != ''
|
|
|
|
|
|
|
|
|
|
ALTER TABLE TImpMember ADD ShopId
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TEmployeeSub
|
|
|
|
|
WHERE FEmpId IN(
|
|
|
|
|
SELECT * FROM TEmployee
|
|
|
|
|
WHERE FNickname != FName)
|
|
|
|
|
|