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.
269 lines
8.6 KiB
269 lines
8.6 KiB
SELECT * FROM TImpMember
|
|
|
|
select db_name()
|
|
|
|
drop table TImpMemberCourse
|
|
|
|
SELECT * FROM TImpMember
|
|
select * from TImpMemberCourse
|
|
|
|
|
|
DELETE TImpMemberCourse
|
|
|
|
DELETE TImpMemberCard WHERE
|
|
--»áÔ±
|
|
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 FBirthdayType VARCHAR(50)
|
|
ALTER TABLE TImpMember ADD FBirthday DATETIME
|
|
ALTER TABLE TImpMember ADD FCompId BIGINT
|
|
ALTER TABLE TImpMember ADD FCardTypeId BIGINT
|
|
ALTER TABLE TImpMember ADD FCreateDate DATETIME
|
|
ALTER TABLE TImpMember ADD FExpiredDate DATETIME
|
|
ALTER TABLE TImpMember ADD FMemo VARCHAR(MAX)
|
|
|
|
|
|
|
|
UPDATE TImpMember SET FMemId = card_id
|
|
UPDATE TImpMember SET FMemId = dbo.FNNewId() WHERE ISNULL(FMemId,0) = 0
|
|
|
|
UPDATE TImpMember SET FMemId = dbo.FNNewId() WHERE FMemId = 0
|
|
|
|
UPDATE TImpMember SET FName = user_name
|
|
UPDATE TImpMember SET FMobile = phone
|
|
|
|
|
|
UPDATE TImpMember SET FCompId = 1
|
|
UPDATE TImpMember SET FGender = CASE WHEN Gender = 'ÄÐ' THEN 1 ELSE 0 END
|
|
UPDATE TImpMember SET FBirthdayType = CASE WHEN Birthday_Type = 'ÒõÀú' THEN 'L' ELSE 'G' END
|
|
UPDATE TImpMember SET FBirthday = birthday
|
|
UPDATE TImpMember SET FCreateDate = create_time
|
|
|
|
|
|
|
|
--ka
|
|
|
|
select * from TImpMemberCard
|
|
|
|
ALTER TABLE TImpMemberCard ADD FCardId BIGINT
|
|
ALTER TABLE TImpMemberCard ADD FMemId BIGINT
|
|
ALTER TABLE TImpMemberCard ADD FCardTypeName VARCHAR(100)
|
|
ALTER TABLE TImpMemberCard ADD FCardNo VARCHAR(50)
|
|
ALTER TABLE TImpMemberCard ADD FBalance DECIMAL(18,6)
|
|
ALTER TABLE TImpMemberCard ADD FBalance2 DECIMAL(18,6)
|
|
ALTER TABLE TImpMemberCard ADD FCardTypeId BIGINT
|
|
ALTER TABLE TImpMemberCard ADD FCreateDate DATETIME
|
|
ALTER TABLE TImpMemberCard ADD FExpiredDate DATETIME
|
|
ALTER TABLE TImpMemberCard ADD FCompId BIGINT
|
|
|
|
UPDATE TImpMemberCard SET FCardNo = card_no
|
|
UPDATE TImpMemberCard SET FBalance = balance_amount
|
|
UPDATE TImpMemberCard SET FCardId = dbo.FNNewId() WHERE ISNULL(FCardId ,0) = 0
|
|
UPDATE TImpMemberCard SET FCardTYpeName = card_name
|
|
UPDATE TImpMemberCard SET FCompId = 1
|
|
|
|
|
|
UPDATE A
|
|
SET A.FMemId = B.FMemId
|
|
FROM TImpMemberCard AS A,TImpMember AS B
|
|
WHERE A.fk_customer_id = b.id
|
|
|
|
|
|
UPDATE A
|
|
SET A.FCardTypeId = B.FId
|
|
FROM TImpMemberCard AS A,TMemberCardType AS B
|
|
WHERE A.FCardTYpeName = b.fname
|
|
|
|
UPDATE TImpMemberCard SET FCreateDate = create_time
|
|
UPDATE TImpMemberCard SET FExpiredDate = end_date
|
|
|
|
UPDATE A
|
|
SET A.FMemNo = B.FCardNO
|
|
FROM TImpMember AS A,TImpMemberCard AS B
|
|
WHERE A.FMemId = B.FMemId
|
|
|
|
UPDATE A
|
|
SET A.FExpiredDate = B.FexpiredDate
|
|
FROM TImpMemberCard AS B,TMemberCard AS A
|
|
WHERE A.FCardId = B.FCardId
|
|
|
|
|
|
|
|
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,
|
|
'' AS FCustom1,'' AS FCustom2,'' AS FCustom3,'' AS FCustom4,'' AS FCustom5
|
|
from TImpMember
|
|
|
|
|
|
--course
|
|
SELECT * FROM TImpMemberCourse
|
|
|
|
ALTER TABLE TImpMemberCourse ADD FCardState INT
|
|
|
|
ALTER TABLE TImpMemberCourse ADD FMemId BIGINT
|
|
ALTER TABLE TImpMemberCourse ADD FCardTypeId BIGINT
|
|
|
|
ALTER TABLE TImpMemberCourse ADD FCalcMode INT
|
|
A
|
|
ALTER TABLE TImpMemberCourse ADD FRemainTimes 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)
|
|
|
|
|
|
UPDATE TImpMemberCourse SET FCardId = dbo.FNNewId() WHERE ISNULL(FCardId ,0) = 0
|
|
|
|
|
|
UPDATE A
|
|
SET A.FMemId = B.FMemId
|
|
FROM TImpMemberCourse AS A,TImpMember AS B
|
|
WHERE A.fk_customer_id = b.id
|
|
|
|
UPDATE A
|
|
SET A.FItemID = B.FId
|
|
FROM TImpMemberCourse AS A,TItem AS B
|
|
WHERE A.card_name = B.FName
|
|
|
|
UPDATE TImpMemberCourse SET FCreateDate = open_date
|
|
UPDATE TImpMemberCourse SET FExpiredDate = end_date
|
|
UPDATE TImpMemberCourse SET FRemainTimes = balance_counts
|
|
|
|
SELECT * FROM TImpMemberCourse WHERE FMemId IS NULL
|
|
|
|
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
|
|
|
|
|
|
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(),'´ÓÀÏϵͳÖе¼Èë'
|
|
FROM TImpMemberCard AS A
|
|
|
|
|
|
|
|
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,0,0,FItemId,1,FRemainTimes,0,0,0,FCreateDate,FExpiredDate,'DR.Import',0,0,0,'ÀÏϵͳµ¼Èë',1,0,1
|
|
FROM TImpMemberCourse AS A
|
|
WHERE FMemId IS NOT NULL
|
|
|
|
-- AND ÌײÍÃû³Æ LIKE '%¿Ë%'
|
|
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 = 0,ItemId = FItemId,PackId = 0,Time = getdate(),InPurTimes = FRemainTimes,InFreeTimes =0,
|
|
OutPurTimes = 0,OutFreeTimes = 0,RemainPurTimes = FRemainTimes,RemainFreeTimes = 0,CompId = 1 ,BillType = 'DR',BizType = 'Import',BillId = 0,BillNo = '',BillDetailId = 0,RecordTime = getdate(),Memo = 'ÀÏϵͳµ¼Èë'
|
|
FROM TImpMemberCourse AS A
|
|
WHERE FMemId IS NOT NULL
|
|
-- AND ÌײÍÃû³Æ LIKE '%¿Ë%'
|
|
|
|
|
|
|
|
SELECT * FROM TImpMemberTransHist
|
|
|
|
ALTER TABLE TImpMemberTransHist ADD FMemId BIGINT
|
|
ALTER TABLE TImpMemberTransHist ADD FId BIGINT
|
|
ALTER TABLE TImpMemberTransHist ADD FCardId BIGINT
|
|
|
|
ALTER TABLE TImpMemberTransHist ADD FBizType VARCHAR(1000)
|
|
ALTER TABLE TImpMemberTransHist ADD FContent VARCHAR(1000)
|
|
ALTER TABLE TImpMemberTransHist ADD FBillNo VARCHAR(1000)
|
|
ALTER TABLE TImpMemberTransHist ADD FAmount DECIMAL(18,6)
|
|
ALTER TABLE TImpMemberTransHist ADD FTime DATETIME
|
|
|
|
UPDATE A
|
|
SET A.FMemId = B.FMemId,
|
|
A.FCardId = b.FCardId
|
|
FROM TImpMemberTransHist AS A,TImpMemberCard AS B
|
|
WHERE A.fk_customer_card_Id = B.id
|
|
|
|
UPDATE TImpMemberTransHist SET FId = dbo.FNNewId() where fiD IS NULL
|
|
UPDATE TImpMemberTransHist SET FContent = pro_name
|
|
UPDATE TImpMemberTransHist SET FBizType = option_type
|
|
UPDATE TImpMemberTransHist SET FBillNo = note_no
|
|
UPDATE TImpMemberTransHist SET FAmount = this_amount
|
|
UPDATE TImpMemberTransHist SET FTime = create_time
|
|
|
|
|
|
|
|
|
|
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,1,'DR',FBizType,FBillNo,FContent,FAmount,1,FAmount,'','',''
|
|
FROM TImpMemberTransHist AS A
|
|
WHERE FMemId IS NOT NULL
|
|
|