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/绮佳/导密控.sql

287 lines
8.2 KiB

use chongqing_qijia
SELECT count(1)
FROM TImpMember
DROP TABLE TImpMember
delete TImpMember
SELECT * INTO TImpMember_Bak FROM TImpMember
SELECT * FROM TImpMember
WHERE FMobile = ''
AND = ''
ORDER BY FMobile
DELETE TImpMember
WHERE FMobile = ''
AND = ''
AND = ''
SELECT * FROM TImpMember
WHERE FMobile != ''
AND = ''
AND = ''
AND = ''
AND = ''
ORDER BY FMobile
DELETE TImpMember
WHERE FMobile != ''
AND = ''
AND = ''
AND = ''
AND = ''
SELECT * FROM TImpMember
ORDER BY FMobile
--处理重复
SELECT * FROM TImpMember
WHERE IN(
SELECT FROM TImpMember
WHERE != ''
GROUP BY
HAVING(COUNT(1) > 1)
)
ORDER BY
SELECT FMemNo FROM TImpMember
GROUP BY FMemNo
HAVING(COUNT(1) > 1)
UPDATE TImpMember SET FCardNo = FMobile WHERE != ''
AND FCardNo = ''
SELECT * FROM TImpMember WHERE FId IN(3240,4511,4210,4049,4220,4520,3336,3529,3337,4487,3974,3326,3885,3679,3308,3985,4480,4283,4067,3959,4185,4143)
DELETE TImpMember WHERE FId IN(3240,4511,4210,4049,4220,4520,3336,3529,3337,4487,3974,3326,3885,3679,3308,3985,4480,4283,4067,3959,4185,4143)
DELETE TImpMember WHERE FId = 14811
UPDATE TImpMember SET FCardNo = 'KDY' + FCardNo ,FMemNO = 'KDY' + FMemNo
WHERE FCardNo IN(SELECT FCardNo FROM TMemberCard)
UPDATE TImpMember SET FCardNo = 'KDY' + FCardNo ,FMemNO = 'KDY' + FMemNo
WHERE FMemNo IN(SELECT FMemNo FROM TMember )
SELECT * FROM TImpMember WHERE FCardNo IN(SELECT FCardNo FROM TMemberCard)
SELECT * FROM TImpMember WHERE FMemNo IN(SELECT FMemNo FROM TMember)
UPDATE TImpMember SET FCardNO = FMobile WHERE FCardNo = ''
WHERE = '微信会员积分卡'
--注销的:
13883803383 666666 10 10 5000 15 32 22 2015-12-03
18098918856 376918669326 10 10 10 2016-07-15
13883803383 1 10 10 2015-06-14
18084042338 0320 10 10 1 288 2015-12-13
18098918856 0314 10 10 1 2015-12-13
18622368306 0094 10 10
18883160036 0004 10 10 2015-10-31
18084042338 10 10 1 2016-09-03
18581205873 10 10 2015-06-12
18084042338
SELECT * FROM TImpMember WHERE FMobile IN('13883803383',
'18098918856',
'13883803383',
'18084042338',
'18098918856',
'18622368306',
'18883160036',
'18084042338',
'18581205873',
'18084042338')
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 FTelephone 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
ALTER TABLE TImpMember ADD FCardState INT
UPDATE TImpMember SET FMemId = FId
UPDATE TImpMember SET FCardId = dbo.FNNewId() WHERE FCardId IS NULL
UPDATE TImpMember SET FCardNo =
UPDATE TImpMember SET FMemNo = FCardNo
UPDATE TImpMember SET FName =
UPDATE TImpMember SET FMobile = ISNULL( ,'')
UPDATE TImpMember SET FCompId = dbo.FNCompId('009')
UPDATE TImpMember SET FBalance = cast( as float)
UPDATE TImpMember SET FGender = 0
UPDATE TImpMember SET FName = FMobile WHERE FName = ''
UPDATE TImpMember SET FName = FMemNo WHERE FName = ''
UPDATE A
SET A.FCardTypeId = B.FId
FROM TMemberCardType AS B,TImpMEMBER AS A
WHERE B.FName = A.
SELECT FROM TImpMember
GROUP BY
SELECT SUM(FBalance) FROM TImpMember
SELECT * FROM TImpMember WHERE FBalance = '17.000000'
SELECT 42486.000000 - 42469
SELECT * FROM TImpMember WHERE FMobile = '18225176070'
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,
'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( 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
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,
ISNULL(FCreateDate,1900) AS FCreateDate,
ISNULL(FExpiredDate,'2117-03-31'),
0 AS FTotalTimes,
0 AS FUsedTimes,
FCompId 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,NULL,''
FROM TImpMember AS A
WHERE FDeleted = 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,A.FCompId,'DR','Import',0,'',A.FBalance,0,A.FBalance,0,getdate(),'从老系统中导入'
FROM TImpMember AS A
WHERE FDeleted = 0
SELECT * FROM TMemberCard WHERE FDeleted = 1 AND FCompId = dbo.FNCompId('009')
DELETE TMemberCard WHERE FCardId = 8010361638326167354
DELETE TMemberCardaCCOUNT WHERE FCardId = 8010361638326167354
DELETE TMemberCardAccthIST WHERE FCardId = 8010361638326167354
SELECT * FROM TMemberCardType WHERE FNo = 'KDY004'
DELETE TMemberCardType WHERE FNo = 'KDY004'
DELETE TMemberCardTypeSub WHERE FCardTYpeId = 4961509796946618201
SELECT * FROM TThirdPartyPayConfig
insert TThirdPartyPayConfig(FCompId,FWeChatPayMchId,FWeChatPayAppId,FAlipayAppId,FAlipayPID)
SELECT FId,'1405280702','','',''
FROM TCompany
WHERE FId NOT IN(SELECT FCompId FROM TThirdPartyPayConfig)