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.
sql-tools/Import/旺点_mdb.sql

593 lines
20 KiB

1 year ago
SELECT * FROM TIMpMember1
SELECT * FROM TIMpMember2
use jinan_Yicai
SELECT * FROM TImpMember2 z
DROP TABLE Member_AccountDetail
SELECT * FROM Member_CardType
SELECT * FROM Member_CardInfo WHERE vhrCardNo = '210289'
SELECT * FROM Member_Account WHERE vhrMemberCardNo = '210289'
SELECT * FROM Member_Info WHERE vhrCode = '03012'
SELECT * FROM Member_AccountDetail WHERE intAccountId = 1015
SELECT SUM(intProperty*decAccountMoney) FROM Member_AccountDetail WHERE intAccountId = 1914
SELECT * FROM Member_CardInfo WHERE intMemberId = 1015
SELECT * FROM Member_Account WHERE intMemberCardId = 1015
SELECT * FROM Member_Account WHERE intID = 5618
SELECT intId,SUM(1)
FROM Member_Account
GROUP BY intId
HAVING(SUM(1) > 1)
DROP TABLE Member_Account
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 10000 + intId,vhrCode,vhrName,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 Member_CardType
where intSaleType = 1
INSERT INTO TMemberCardTypeSub(FId,FCompId,FCardTypeId,FAllowSale,FAllowRchg,FEnabled)
SELECT dbo.FNNewId(),dbo.FNCompId('001'),I.FId,1,1,1
FROM TMemberCardType AS I
WHERE FId < 30000
CREATE TABLE TImpCourse
(
FItemId BIGINT,
FCourseId BIGINT,
FItemNo VARCHAR(100),
FItemName VARCHAR(100)
)
INSERT TImpCourse(FItemId,FCourseId,FItemNo,FItemName)
SELECT 30000+ intId,10000+intId,vhrName,vhrName
FROM Member_CardType
where intSaleType = 2
GROUP BY vhrName,intId
SELECT * FROM TImpMemberCourse
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, 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 IN( dbo.FNCompId('001'),dbo.FNCompId('002'))
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
ALTER TABLE Member_Info ADD FMemId BIGINT
ALTER TABLE Member_Info ADD FMemNo VARCHAR(50)
ALTER TABLE Member_Info ADD FName VARCHAR(50)
ALTER TABLE Member_Info ADD FGender INT
ALTER TABLE Member_Info ADD FMobile VARCHAR(50)
ALTER TABLE Member_Info ADD FTelephone VARCHAR(50)
ALTER TABLE Member_Info ADD FCreateDate DATETIME
ALTER TABLE Member_Info ADD FExpiredDate DATETIME
ALTER TABLE Member_Info ADD FCompId BIGINT
ALTER TABLE Member_Info ADD FMemo VARCHAR(1000)
ALTER TABLE Member_Info ADD FArrear DECIMAL(18,6)
ALTER TABLE Member_Info ADD FPoint DECIMAL(18,6)
ALTER TABLE Member_Info ADD FBirthday DATETIME
ALTER TABLE Member_Info ADD FBirthdayType CHAR
ALTER TABLE Member_Info ADD FState INT
ALTER TABLE Member_Info ADD FDeleted BIT DEFAULT 0 NOT NULL
ALTER TABLE Member_CardInfo ADD FCardNo VARCHAR(50)
ALTER TABLE Member_CardInfo ADD FCardTypeId BIGINT
ALTER TABLE Member_CardInfo ADD FBalance DECIMAL(18,6)
ALTER TABLE Member_CardInfo ADD FRemainTimes DECIMAL(18,6)
ALTER TABLE Member_CardInfo ADD FUsedPurTimes DECIMAL(18,6)
ALTER TABLE Member_CardInfo ADD FPurTimes DECIMAL(18,6)
ALTER TABLE Member_CardInfo ADD FPurAmount DECIMAL(18,6)
ALTER TABLE Member_CardInfo ADD FItemId BIGINT
ALTER TABLE Member_CardInfo ADD FCardId BIGINT
ALTER TABLE Member_CardInfo ADD FMemo VARCHAR(1000)
ALTER TABLE Member_CardInfo ADD FMemId BIGINT
ALTER TABLE Member_CardInfo ADD FState INT
ALTER TABLE Member_CardInfo ADD FCreateDate DATETIME
ALTER TABLE Member_CardInfo ADD FExpiredDate DATETIME
ALTER TABLE Member_CardInfo ADD FDeleted BIT DEFAULT 0 NOT NULL
ALTER TABLE Member_CardInfo ADD FIsCourse BIT
ALTER TABLE Member_CardInfo ADD FCompId BIGINT
select top 11* from Member_Info
UPDATE Member_Info SET FCompId = 1
UPDATE Member_Info SET FMemNo = vhrCode
UPDATE Member_Info SET FMemId = 10000+intId
UPDATE Member_Info SET FName = vhrName
UPDATE Member_Info SET FMobile = ISNULL( vhrMobilePhone, vhrTel)
UPDATE Member_Info SET FTelephone = ISNULL( vhrTel, '')
UPDATE Member_Info SET FGender = CASE WHEN vhrSex='<EFBFBD><EFBFBD>' THEN 1 ELSE '0' END
UPDATE Member_Info SET FCreateDate = dtmCreateTime
UPDATE Member_Info SET FMemo = txtRemark
UPDATE Member_Info SET FBirthday = vhrBirthday
UPDATE Member_Info SET FBirthdayType = 'G'
UPDATE Member_Info SET FMemo = ISNULL(txtRemark,'')
UPDATE A
SET A.FPoint = B.<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
FROM Member_Info AS A,V_MemberCard_Account AS B
WHERE A.intId = B.intMemberId
UPDATE Member_Info SET FDeleted = 0
UPDATE Member_Info SET FDeleted = 1 WHERE intIsDel = 1
SELECT * FROM Member_CardInfo WHERE intStatus != 0
UPDATE Member_CardInfo SET FDeleted = 0
UPDATE Member_CardInfo SET FDeleted = 1 WHERE intStatus != 0 AND vhrStatusReason = '<EFBFBD>˿<EFBFBD>'
UPDATE Member_CardInfo SET FState = 1
UPDATE Member_CardInfo SET FState = 5 WHERE intStatus != 0 AND vhrStatusReason = '<EFBFBD><EFBFBD>ʧ'
UPDATE Member_CardInfo SET FDeleted = 1 WHERE intMemberId IN(SELECT intId FROM Member_Info WHERE FDeleted = 1)
UPDATE Member_Info SET FDeleted = 1 WHERE intId IN(SELECT intMemberId FROM Member_CardInfo WHERE FDeleted = 1)
--Card
UPDATE Member_CardInfo SET FCompId = 1
UPDATE Member_CardInfo SET FCardTypeID = 10000 + intCardTypeId
UPDATE Member_CardInfo SET FCardId = 10000 + intID
UPDATE Member_CardInfo SET FMemId = 10000 + intMemberId
UPDATE Member_CardInfo SET FCardNo = vhrCardNo
UPDATE Member_CardInfo SET FCreateDate = dtmCreateTime
UPDATE Member_CardInfo SET FMemo = isnull(txtRemark,'')
UPDATE Member_CardInfo SET FExpiredDate = DATEADD(YEAR,100,FCreateDate)
SELECT * FROM Member_CardInfo where vhrStatusReason != '<EFBFBD><EFBFBD><EFBFBD><EFBFBD>'
SELECT * FROM Member_CardInfo WHERE intId = 3415
SELECT * FROM V_MemberCard_Account
UPDATE A
SET A.FBalance =B.<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
FROM Member_CardInfo AS A, V_MemberCard_Account AS B
WHERE A.intId = B.intIds
SELECT * FROM V_MemberCard_Account WHERE intMemberId = 1209
SELECT * FROM Member_CardInfo WHERE FBalance IS NULL
AND FMemId IN(SELECT FMemId FROM Member_Info WHERE FDeleted = 0 AND intStatus = 0)
SELECT * FROM Member_Info WHERE FDeleted = 0 AND intStatus = 0
SELECT SUM(1) FROM Member_CardInfo WHERE FDeleted = 0 AND FState = 1
SELECT SUM(1),SUM(FBalance) FROM Member_CardInfo AS A,Member_CardType AS B
WHERE FDeleted = 0 --AND FState = 1
AND A.intCardTypeID = b.intId
AND B.intId > 0
AND b.intSaleType = 1
SELECT vhrCode,SUM(1),SUM(FBalance) FROM Member_CardInfo AS A,Member_CardType AS B
WHERE FDeleted = 0 -- AND FState = 1
AND A.intCardTypeID = b.intId
AND b.intSaleType = 1
GROUP BY vhrCode
SELECT * FROM Member_CardInfo WHERE vhrCardTypeCode = '71'
SELECT * FROM Member_Account WHERE intMemberCardId = 3496
SELECT * FROM Member_AccountDetail WHERE intAccountId = 6496
SELECT * FROM Member_AccountDetail$ WHERE intAccountId = 6496
SELECT * FROM Member_AccountDetail$1 WHERE intAccountId = 6496
SELECT * FROM Member_CardType
SELECT * FROM Member_CardInfo WHERE intCardTypeID NOT IN(SELECT intId FROM Member_CardType)
--Course
UPDATE Member_CardInfo SET FIsCourse = 0
UPDATE Member_CardInfo SET FIsCourse = 1 WHERE intCardTypeId IN(SELECT intId FROM Member_CardType WHERE intSaleType = 2)
UPDATE Member_CardInfo SET FItemId = 30000+ intCardTypeId WHERE FIsCourse = 1
UPDATE A
SET A.FRemainTimes = ISNULL(B.ʣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,0)
FROM Member_CardInfo AS A,V_MemberCard_Account AS B
WHERE A.intId = B.intId
AND FIsCourse = 1
SELECT FRemainTimes FROM Member_CardInfo WHERE FRemainTimes > 0
UPDATE Member_CardInfo SET FPurTimes = FRemainTimes
UPDATE Member_CardInfo SET FUsedPurTimes = 0
SELECT * FROM V_MemberCard_Account WHERE <EFBFBD><EFBFBD><EFBFBD>ѷ<EFBFBD>ʽ = '<EFBFBD>ο<EFBFBD>'
SELECT * FROM Member_CardInfo WHERE intId = 1816
--<EFBFBD><EFBFBD>ʼ
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,
1 AS FCompId,
ISNULL(FCreateDate ,'1900-01-01') AS FCreateDate,
FGender AS FGender,
'G' AS FBirthdayType,
FBirthday AS FBirthday,
ISNULL(FTelephone,'') 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( 0,0) AS FPoint,
1 AS FRecvConsSMS,
1 AS FRecvBulkSMS,
ISNULL('','') AS FMemo,
'' AS FCustom1,'' AS FCustom2,'' AS FCustom3,'' AS FCustom4,'' AS FCustom5
from Member_Info
WHERE FDeleted = 1
AND FMemId IN(SELECT FMemId FROM Member_CardInfo )
delete TMember WHERE FMemId IN(SELECT FMemId FROM Member_CardInfo)
select count(1) from member_info
--<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
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,
1 AS FCompId,
FMemId AS FMemId,
ISNULL(FState ,1)AS FState,
ISNULL(FCreateDate,1900) AS FCreateDate,
ISNULL(FExpiredDate,'9000-01-01'),
0 AS FTotalTimes,
0 AS FUsedTimes,
1 AS FSaleCompId,
0 AS FSaleBillId,
ISNULL(FMemo,'') AS FMemo
FROM Member_CardInfo
WHERE FDeleted = 0
AND FIsCourse = 0
INSERT TMemberCardAccount(FMemId,FId,FCardId,FAcctId,FDeposit,FBalance,FArrear,FCreateDate,FExpiredDate,FMemo)
SELECT FMemId,dbo.FNNewId(),FCardId AS FCardId,3,ISNULL(FBalance,0),ISNULL(FBalance,0),0,FCreateDate,DATEADD(year,100, FCreateDate) AS FExpiredDate,''
FROM Member_CardInfo AS A
WHERE FDeleted = 0
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,1,'DR','Import',0,'',ISNULL(A.FBalance,0),0,ISNULL(A.FBalance,0),0,getdate(),''
FROM Member_CardInfo AS A
WHERE FDeleted = 0
AND FIsCourse = 0
--Course
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,FUsedPurTimes,0,0,0,FCreateDate,FExpiredDate,'DR.Import',0,0,0,'<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',1,0
FROM Member_CardInfo AS A
WHERE FDeleted = 0
AND FIsCourse = 1
--AND intCardTypeId NOT IN(SELECT intId FROM Member_CardType)
AND FITEMiD not in(select fid from titem)
SELECT * FROM TMember
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,FUsedPurTimes,0,FCompId,'DR','Import',0,'',0,getdate()
FROM Member_CardInfo AS A
WHERE FDeleted = 0
AND FIsCourse = 1
--End OF 2
--------------------------------------------------------------------------
DROP TABLE TIMpMember1
DROP TABLE TIMpMember3
DROP TABLE TImpMember
SELECT * INTO TImpMember FROM TImpMember1 WHERE 1=0
--
UPDATE TIMpMember1 SET <EFBFBD><EFBFBD>Ƭ<EFBFBD><EFBFBD> = <EFBFBD><EFBFBD>Ƭ<EFBFBD><EFBFBD> + '1' WHERE <EFBFBD><EFBFBD>Ƭ<EFBFBD><EFBFBD> = '<EFBFBD><EFBFBD>ֵ<EFBFBD><EFBFBD>'
UPDATE TIMpMember3 SET <EFBFBD><EFBFBD>Ƭ<EFBFBD><EFBFBD> = <EFBFBD><EFBFBD>Ƭ<EFBFBD><EFBFBD> + '1' WHERE <EFBFBD><EFBFBD>Ƭ<EFBFBD><EFBFBD> = '<EFBFBD><EFBFBD>ֵ<EFBFBD><EFBFBD>'
SELECT <EFBFBD><EFBFBD><EFBFBD><EFBFBD> INTO #Member1 FROM TIMpMember1 WHERE <EFBFBD><EFBFBD><EFBFBD><EFBFBD> IN(SELECT <EFBFBD><EFBFBD><EFBFBD><EFBFBD> FROM TIMpMember3)
SELECT <EFBFBD><EFBFBD><EFBFBD><EFBFBD> INTO #Member3 FROM TIMpMember3 WHERE <EFBFBD><EFBFBD><EFBFBD><EFBFBD> IN(SELECT <EFBFBD><EFBFBD><EFBFBD><EFBFBD> FROM TIMpMember1)
UPDATE TIMpMember1 SET <EFBFBD><EFBFBD><EFBFBD><EFBFBD> = <EFBFBD><EFBFBD><EFBFBD><EFBFBD> + '_1' WHERE <EFBFBD><EFBFBD><EFBFBD><EFBFBD> IN(SELECT <EFBFBD><EFBFBD><EFBFBD><EFBFBD> FROM #Member1)
UPDATE TIMpMember3 SET <EFBFBD><EFBFBD><EFBFBD><EFBFBD> = <EFBFBD><EFBFBD><EFBFBD><EFBFBD> + '_3' WHERE <EFBFBD><EFBFBD><EFBFBD><EFBFBD> IN(SELECT <EFBFBD><EFBFBD><EFBFBD><EFBFBD> FROM #Member1)
INSERT TImpMember
SELECT * FROM TIMpMember1
INSERT TImpMember
SELECT * FROM TIMpMember3
SELECT * FROM TImpMember1 WHERE <EFBFBD><EFBFBD><EFBFBD><EFBFBD> = '900539'
SELECT * FROM TImpMember3 WHERE <EFBFBD><EFBFBD><EFBFBD><EFBFBD> = '900539'
UPDATE TImpMember SET <EFBFBD><EFBFBD><EFBFBD><EFBFBD> = <EFBFBD><EFBFBD><EFBFBD><EFBFBD> + '_1'
SELECT FMemNo ,SUM(1)
FROM TImpMember
GROUP BY FMemNo
HAVING(SUM(1) > 1)
ALTER TABLE TImpMember ADD FMemId BIGINT
ALTER TABLE TImpMember 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 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 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
ALTER TABLE TImpMember ADD FDeleted BIT DEFAULT 0 NOT NULL
SELECT * FROM TImpMember
UPDATE TImpMember SET FCompID = 1
UPDATE TImpMember SET FMemNo = <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
UPDATE TImpMember SET FCardNO = FMemNo
UPDATE TImpMember SET FMemId = dbo.FNNewId() WHERE FMemid IS NULL
UPDATE TImpMember SET FCardId = dbo.FNNewId() WHERE FCardId IS NULL
UPDATE TImpMember SET FName = <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
UPDATE TImpMember SET FGender = CASE WHEN <EFBFBD>Ա<EFBFBD>='<EFBFBD><EFBFBD>' THEN 1 ELSE '0' END
UPDATE TImpMember SET FBalance = <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
--UPDATE TImpMember SET FDeleted = 1 WHERE ISNULL(״̬,'') = '<EFBFBD><EFBFBD><EFBFBD><EFBFBD>'
UPDATE TImpMember SET FPoint = ʣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
UPDATE TImpMember SET FBirthdayType = 'G'
UPDATE TImpMember SET FBirthday = NULL
UPDATE TImpMember SET FMobile = <EFBFBD>
UPDATE TImpMember SET FCreateDate = <EFBFBD>ʱ<EFBFBD><EFBFBD>
UPDATE TImpMember SET FExpiredDate = <EFBFBD><EFBFBD>Ч<EFBFBD><EFBFBD>
UPDATE TImpMember SET FMemo = <EFBFBD><EFBFBD>ע
UPDATE A
SET A.FCardTypeId = B.FId
FROM TImpMember AS A,TMemberCardType AS B
WHERE A.<EFBFBD><EFBFBD>Ƭ<EFBFBD><EFBFBD> = B.FName
SELECT * FROM TIMpMember WHERe <EFBFBD><EFBFBD>״̬ != 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,
1 AS FCompId,
ISNULL(FCreateDate ,'1900-01-01') AS FCreateDate,
FGender AS FGender,
'G' 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( 0,0) AS FPoint,
1 AS FRecvConsSMS,
1 AS FRecvBulkSMS,
ISNULL('','') AS FMemo,
'' AS FCustom1,'' AS FCustom2,'' AS FCustom3,'' AS FCustom4,'' AS FCustom5
from TImpMember
--<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
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,
1 AS FCompId,
FMemId AS FMemId,
1 AS FState,
ISNULL(FCreateDate,1900) AS FCreateDate,
ISNULL(FExpiredDate,'9999-01-01'),
0 AS FTotalTimes,
0 AS FUsedTimes,
1 AS FSaleCompId,
0 AS FSaleBillId,
ISNULL(FMemo,'') AS FMemo
FROM TImpMember
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,100, FCreateDate) AS FExpiredDate,''
FROM TImpMember 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,1,'DR','Import',0,'',A.FBalance,0,A.FBalance,0,getdate(),''
FROM TImpMember AS A
---------------------------------------------------------------------------
SELECT * FROM Member_CardType
WHERE intId IN(SELECT intCardTypeId FROM Member_CardInfo)
INSERT TMemberOldTransHist(FId,FMemId,FTime,FCardId,FCompId,FBillType,FBizType,FTransNo,FContent,FPrice,FQuantity,FAmount,FPayment,FEmployee,FMemo)
SELECT 100000 + B.intID,M.FMemId,A.dtmCreateTime,0,dbo.FNCompId('001'),'DR','Import',a.vhrBillCode,ISNULL(B.vhrItemName,''),ISNULL(B.decDiscountTotal,0),ISNULL(B.decAmount,0),ISNULL(B.decDiscountTotal,0),'','',isnull(B.vhrNote,'')
FROM Sale_Bill AS A,Sale_BillEntry AS B,TImpMember AS M
WHERE A.intID = B.intBillId
AND A.intBuyerId = M.MemberId
sp_rename 'Sale_BillEntry','Sale_BillEntry_002'
SELECT 3*3.14
SELECT 6*3.14