You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

348 lines
11 KiB

1 year ago
SELECT CardTypeName FROM TImpMember
WHERE CardTypeName NOT IN(SELECT FCardTypeName FROM TImpCardType)
GROUP BY CardTypeName
SELECT * FROM TCompany
<EFBFBD><EFBFBD><EFBFBD>а<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>޹<EFBFBD>˾
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 TImpMemberPack
WHERE FCardId = 3257267
--<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƴ<EFBFBD>
ALTER TABLE TImpMemberPack ADD FMemId BIGINT
ALTER TABLE TImpMemberPack ADD FCreateDate DATETIME
ALTER TABLE TImpMemberPack ADD FExpiredDate DATETIME
ALTER TABLE TImpMemberPack ADD FItemId BIGINT
ALTER TABLE TImpMemberPack ADD FCourseId BIGINT
ALTER TABLE TImpMemberPack ADD FMemCourseId BIGINT
UPDATE A
SET A.FCreateDate = dtmCreateTime,
A.FExpiredDate = dtmLimitDate
FROM TImpMemberPack AS A
UPDATE A
SET A.FMemCourseId = dbo.FNnewId()
FROM TImpMemberPack AS A
WHERE A.FMemCourseId IS NULL
UPDATE A
SET A.FMemId = B.FMemId
FROM TImpMemberPack AS A ,TImpMember AS B
WHERE A.FCardId = B.Id
UPDATE A
SET A.FItemId = B.FItemId,
A.FCourseId = B.FId
FROM TCourse AS B,TImpMemberPack AS A
WHERE B.FNo = '1001L1'
SELECT * FROM TImpMember WHERE Id = 2934498
SELECT * FROM TImpError
delete TImpError
SELECT * FROM TMemberCourse
DELETE TCourse WHERE FName NOT LIKE '%<EFBFBD>꿨%'
SELECT * INTO TMember_Exist FROM TMember WHERE FMemId IN(SELECT FMemId FROM TMember_Exist)
SELECT * INTO TMemberCard_Exist FROM TMemberCard WHERE FMemId IN(SELECT FMemId FROM TMember_Exist)
SELECT * INTO TMemberCardAccount_Exist FROM TMemberCardAccount WHERE FMemId IN(SELECT FMemId FROM TMember_Exist)
SELECT * INTO TMemberCardAcctHist_Exist FROM TMemberCardAcctHist WHERE FMemId IN(SELECT FMemId FROM TMember_Exist)
SELECT * INTO TMemberOldTransHist_Exist FROM TMemberOldTransHist WHERE FMemId IN(SELECT FMemId FROM TMember_Exist)
SELECT * INTO TMemberCardOldAcctHist_Exist FROM TMemberCardOldAcctHist WHERE FMemId IN(SELECT FMemId FROM TMember_Exist)
DROP TABLE TMemberCardOldAcctHist_Exist
DROP TABLE TMemberOldTransHist_Exist
DROP TABLE TMemberCardAccount_Exist
DROP TABLE TMemberOldTransHist_Exist
DELETE TMember WHERE FMemId IN(SELECT FMemId FROM TMember_Exist)
DELETE TMemberCard WHERE FMemId IN(SELECT FMemId FROM TMember_Exist)
DELETE TMemberCardAccount WHERE FMemId IN(SELECT FMemId FROM TMember_Exist)
DELETE TMemberCardAcctHist WHERE FMemId IN(SELECT FMemId FROM TMember_Exist)
DELETE TMemberOldTransHist WHERE FMemId IN(SELECT FMemId FROM TMember_Exist)
DELETE TMemberCardOldAcctHist WHERE FMemId IN(SELECT FMemId FROM TMember_Exist)
--<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵͳ<EFBFBD>Ļ<EFBFBD>ԱID<EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD>
UPDATE A
SET A.FMemId = B.FMemId
FROM TMember_Exist AS B,TImpMember AS A
WHERE B.FMemNo = A.CardNo
UPDATE A
SET A.FCardId = B.FCardId
FROM TMemberCard_Exist AS B,TImpMember AS A
WHERE B.FCardNo = A.CardNo
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 FMemId BIGINT
ALTER TABLE TImpMember ADD FMemNo VARCHAR(50)
ALTER TABLE TImpMember ADD FName VARCHAR(50)
ALTER TABLE TImpMember ADD FGender INT
ALTER TABLE TImpMember ADD FMobile VARCHAR(50)
ALTER TABLE TImpMember ADD FCardTypeId BIGINT
ALTER TABLE TImpMember ADD FCourseId BIGINT
ALTER TABLE TImpMember ADD FBalance DECIMAL(18,6)
ALTER TABLE TImpMember ADD FRemainTimes INT
ALTER TABLE TImpMember ADD FPurTimes INT
ALTER TABLE TImpMember ADD FPurAmount DECIMAL(18,6)
ALTER TABLE TImpMember ADD FItemId BIGINT
ALTER TABLE TImpMember ADD FCreateDate DATETIME
ALTER TABLE TImpMember ADD 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)
UPDATE TImpMember SET FMemId = dbo.FNNewId() WHERE FMemid IS NULL
UPDATE TImpMember SET FCardId = dbo.FNNewId() WHERE FCardId IS NULL
UPDATE TImpMember SET FMemNo = CardNo
UPDATE TImpMember SET FName = MemberName
UPDATE TImpMember SET FMobile = MobilePhone
UPDATE TImpMember SET FGender = CASE WHEN Sex = '<EFBFBD><EFBFBD>' THEN 1 ELSE '0' END
UPDATE TImpMember SET FBalance = Balance
UPDATE TImpMember SET FRemainTimes = <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
UPDATE TImpMember SET FPurTimes = <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
UPDATE TImpMember SET FPurAmount = <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
UPDATE TImpMember SET FCreateDate = CreateTime
UPDATE TImpMember SET FCompId = (SELECT FId FROM TCompany WHERE FNo = '003')
UPDATE TImpMember SET FArrear = Ƿ<EFBFBD><EFBFBD>
UPDATE TImpMember SET FMemo = remark
UPDATE TImpMember SET FPoint = cast(JF as float)
UPDATE A SET A.FCardTypeId = B.FCardTypeId
FROM TImpMember AS A,TImpCardType AS B
WHERE A.CardTypeName = B.FCardTypeName
CREATE TABLE TImpCardType
(
FCardTypeName VARCHAR(500),
FCardTypeNo VARCHAR(50),
FCardTypeId BIGINT
)
DELETE TImpCardType
INSERT TImpCardType(FCardTypeName,FCardTypeNo,FCardTypeId)
SELECT '<EFBFBD><EFBFBD>ʯ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','1/6',0 UNION ALL
SELECT '<EFBFBD><EFBFBD>ʯ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','06',0 UNION ALL
SELECT '<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','05',0 UNION ALL
SELECT '<EFBFBD><EFBFBD>ʯ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','07',0 UNION ALL
SELECT '300Ԫ<EFBFBD><EFBFBD><EFBFBD>ۿ<EFBFBD>','085',0 UNION ALL
SELECT '<EFBFBD><EFBFBD>ʯ<EFBFBD><EFBFBD>','1/6',0 UNION ALL
SELECT '<EFBFBD>׽<EFBFBD><EFBFBD><EFBFBD>','1/6.5',0 UNION ALL
SELECT '<EFBFBD><EFBFBD><EFBFBD><EFBFBD>','1/7.5',0 UNION ALL
SELECT 'ˮ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>','1/7',0 UNION ALL
SELECT '<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','1/7.5',0 UNION ALL
SELECT '<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','1/8',0 UNION ALL
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 A
SET A.FCardTypeId = B.FId
FROM TImpCardType AS A,TMemberCardType AS B
WHERE A.FCardTypeNo = B.FNo
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 TImpMemberLog
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')
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,
'G' AS FBirthdayType,
NULL 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,
FPoint AS FPoint,
1 AS FRecvConsSMS,
1 AS FRecvBulkSMS,
FMemo AS FMemo,
'<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' AS FCustom1,'' AS FCustom2,'' AS FCustom3,'' AS FCustom4,'' AS FCustom5
from TImpMember
INSERT INTO TMemberCard(
FCardId,
FCardNo,
FCardFaceNo,
FTypeId,
FValueType,
FCompId,
FMemId,
FState,
FCreateDate,
FExpiredDate,
FTotalTimes,
FUsedTimes,
FSaleCompId,
FSaleBillId,
FMemo)
SELECT
FCardId AS FId,
FMemno AS FNo,
FMemno 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,
DATEADD(year,1, FCreateDate) AS FExpiredDate,
0 AS FTotalTimes,
0 AS FUsedTimes,
FCompId AS FSaleCompId,
0 AS FSaleBillId,
'' 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 TMemberCourse(FId,FMemId,FCourseId,FMemPackId,FItemId,FCompId,FPurTimes,FPurAmount,FFreeTimes,FFreeAmount,FPurchaseDate,FExpiredDate,FBizType,FTransId,FArrear,FDurable,FMemo,FCalcMode,FAdjustPrice)
SELECT FMemCourseId,FMemId,FCourseId,0,FItemId,1,0,0,0,0,FCreateDate,FExpiredDate,'DR.Import',0,0,0,'<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',2,0
FROM TImpMemberPack AS A
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 TImpMemberPack 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
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 TImpMemberLog AS A
WHERE ISNULL(FMemId,0) != 0
AND <EFBFBD><EFBFBD>Ա<EFBFBD><EFBFBD><EFBFBD><EFBFBD> != ''
WHERE A.FNo = hykh