|
|
|
|
|
|
|
|
|
P
|
|
|
|
|
|
|
|
|
|
update TMemberCardType SET FId = cast(cast(FNo as binary(8)) as bigint)
|
|
|
|
|
WHERE FId != 0
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TMemberCardType WHERE FId = 3746994889972252672
|
|
|
|
|
SELECT * FROM TMemberCardType
|
|
|
|
|
|
|
|
|
|
SELECT top 1 id,leaguer_name,leaguer_tel,leaguer_sex,cardid,cardname,cardsta,leaguer_birth,cardbal,
|
|
|
|
|
card_bgndt,card_duedt,card_yajin,leaguer_pasw,lost_dt,l_memo,cardidid
|
|
|
|
|
FROM c_leaguer
|
|
|
|
|
|
|
|
|
|
select *into TBGMember from mg.censunedb.dbo.c_leaguer
|
|
|
|
|
|
|
|
|
|
alter table TBGMember ADD FId BIGINT NOT NULL DEFAULT 0
|
|
|
|
|
UPDATE TBGMember SET FId = dbo.FNNewId()
|
|
|
|
|
|
|
|
|
|
ALTER TABLE TBGMember ADD FCompId BIGINT
|
|
|
|
|
UPDATE TBGMember SET FCompId = (SELECT FId FROM TCompany WHERE FNo = '002')
|
|
|
|
|
WHERE open_brhid = '001'
|
|
|
|
|
|
|
|
|
|
UPDATE TBGMember SET FCompId = (SELECT FId FROM TCompany WHERE FNo = '003')
|
|
|
|
|
WHERE open_brhid = '002'
|
|
|
|
|
|
|
|
|
|
UPDATE TBGMember SET FCompId = (SELECT FId FROM TCompany WHERE FNo = '004')
|
|
|
|
|
WHERE open_brhid = '003'
|
|
|
|
|
|
|
|
|
|
UPDATE TBGMember SET FCompId = (SELECT FId FROM TCompany WHERE FNo = 'Z004')
|
|
|
|
|
WHERE open_brhid = '004'
|
|
|
|
|
|
|
|
|
|
UPDATE TBGMember SET FCompId = (SELECT FId FROM TCompany WHERE FNo = 'Z005')
|
|
|
|
|
WHERE open_brhid = '005'
|
|
|
|
|
|
|
|
|
|
UPDATE TBGMember SET FCompId = (SELECT FId FROM TCompany WHERE FNo = 'Z006')
|
|
|
|
|
WHERE open_brhid = '006'
|
|
|
|
|
|
|
|
|
|
UPDATE TBGMember SET FCompId = (SELECT FId FROM TCompany WHERE FNo = 'Z009')
|
|
|
|
|
WHERE open_brhid = '009'
|
|
|
|
|
|
|
|
|
|
UPDATE TBGMember SET FCompId = 1
|
|
|
|
|
WHERE FCompId IS NULL
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TBGMember WHERE FCompId IS NULL
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TBGMember WHERE cardid = 'ddd100496'
|
|
|
|
|
SELECT * FROM TBGMember WHERE cardsta IN( '<EFBFBD>ܲ<EFBFBD>ͣ<EFBFBD><EFBFBD>')
|
|
|
|
|
|
|
|
|
|
SELECT top 1111 * FROM TBGMember
|
|
|
|
|
ORDER BY card_bgndt desc
|
|
|
|
|
|
|
|
|
|
WHERE open_brhid = '006'
|
|
|
|
|
|
|
|
|
|
13688671326
|
|
|
|
|
UPDATE TBGMember SET FDeleted = 1 WHERE cardsta IN( '<EFBFBD><EFBFBD><EFBFBD><EFBFBD>' ,'<EFBFBD>˿<EFBFBD>','<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ת')
|
|
|
|
|
290411328
|
|
|
|
|
13808906773
|
|
|
|
|
|
|
|
|
|
--ɾ<EFBFBD><EFBFBD><EFBFBD>ظ<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
delete TBGMember
|
|
|
|
|
WHERE FId IN(
|
|
|
|
|
select min(FId)--,leaguer_name,leaguer_tel,cardid,cardbal
|
|
|
|
|
from TBGMember
|
|
|
|
|
where cardid in(select cardid from TBGMember group by cardid having(count(1) > 1))
|
|
|
|
|
group by leaguer_name,leaguer_tel,cardid,cardbal
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
select *
|
|
|
|
|
from TBGMember
|
|
|
|
|
where cardid in(select cardid from TBGMember group by cardid having(count(1) > 1))
|
|
|
|
|
group by leaguer_name,leaguer_tel,cardid,cardbal
|
|
|
|
|
15820053988
|
|
|
|
|
|
|
|
|
|
select id from #Card group by id having(count(1) > 1)
|
|
|
|
|
|
|
|
|
|
select * from TMemberImport
|
|
|
|
|
|
|
|
|
|
alter table TMember ALTER COLUMN FMobilePhone VARCHAR(100)
|
|
|
|
|
|
|
|
|
|
Truncate table TMemberImport
|
|
|
|
|
INSERT INTO TMemberImport(FCompId,FId,FMemId,FMemNo,FCardId,FCardNo,FName,FGender,FMobilePhone,FCreateDate,FExpiredDate,
|
|
|
|
|
FCardTypeId,FAcctId,FBalance,FAcctId2,FBalance2,FState,FMemo)
|
|
|
|
|
|
|
|
|
|
SELECT FCompId,
|
|
|
|
|
dbo.FNNewId(),
|
|
|
|
|
FId AS FMemId,
|
|
|
|
|
rtrim(cardId) AS FMemNo,
|
|
|
|
|
FId AS FCardId,
|
|
|
|
|
rtrim(cardId) AS FCardNo,
|
|
|
|
|
cast( rtrim(isnull(leaguer_name,'')) as VARCHAR(100)) AS FName,
|
|
|
|
|
CASE rtrim(leaguer_sex) WHEN '<EFBFBD><EFBFBD>' THEN 1 ELSE 0 END,
|
|
|
|
|
-- '122',
|
|
|
|
|
rtrim(isnull(leaguer_tel,'')) AS FMobilePhone,
|
|
|
|
|
card_bgndt AS FCreateDate,
|
|
|
|
|
card_duedt as FExpiredDate,
|
|
|
|
|
cast(cast(rtrim(cardname) as binary(8)) as bigint) AS FCardTypeId,
|
|
|
|
|
3 AS FAcctId,
|
|
|
|
|
cardbal AS FBalance,
|
|
|
|
|
0 AS FAcct2,
|
|
|
|
|
0 AS FBalance2,
|
|
|
|
|
case rtrim(isnull(cardsta,''))
|
|
|
|
|
when '<EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then 3
|
|
|
|
|
when '<EFBFBD><EFBFBD>ʧ' then 4
|
|
|
|
|
when '<EFBFBD>˿<EFBFBD>' then 2
|
|
|
|
|
when '<EFBFBD>ܲ<EFBFBD>ͣ<EFBFBD><EFBFBD>' then 4
|
|
|
|
|
else 1 end AS FState ,
|
|
|
|
|
rtrim(isnull(l_memo,'') ) AS FMemo
|
|
|
|
|
FROM TBGMember
|
|
|
|
|
WHERE ISNULL(FDeleted,0) = 0
|
|
|
|
|
order by cardid
|
|
|
|
|
|
|
|
|
|
UPDATE TMemberImport
|
|
|
|
|
SET FMemNo = FMemNO + '.BG' ,
|
|
|
|
|
FCardNo = FCardNo + '.BG'
|
|
|
|
|
WHERE FMemNo IN(SELECT FMemNo FROM TMember)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UPDATE TMemberImport SET FCardNo = FCardNo + '.BG' WHERE FMemNo IN(SELECT FCardNo FROM TMember)
|
|
|
|
|
UPDATE TMemberImport SET FCardNo = FCardNo, '.BG' WHERE FMemNo IN(SELECT FCardNo FROM TMember)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
select * from #Card WHERE cardId In
|
|
|
|
|
(
|
|
|
|
|
select cardid from
|
|
|
|
|
(
|
|
|
|
|
SELECT cardid,sum(1)as cnt from #Card
|
|
|
|
|
group by cardid
|
|
|
|
|
order by sum(1) desc
|
|
|
|
|
) as t where cnt > 1
|
|
|
|
|
)
|
|
|
|
|
order by cardid
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SELECT cardsta FROM TBGMember GROUP BY cardsta
|
|
|
|
|
|
|
|
|
|
SELECT * FROM #Card WHERE cardid = '444290401123'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
alter table TMember A
|
|
|
|
|
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,FState,FData)
|
|
|
|
|
SELECT FMemId AS FId,
|
|
|
|
|
FMemNo AS FNo,
|
|
|
|
|
FName AS FName,
|
|
|
|
|
FBriefCode AS FBriefCode,
|
|
|
|
|
0 AS FTypeId,
|
|
|
|
|
FCompId AS FCompId,
|
|
|
|
|
FCreateDate AS FCreateDate,
|
|
|
|
|
FGender AS FGender,
|
|
|
|
|
FBirthdayType AS FBirthdayType,
|
|
|
|
|
FBirthday AS FBirthday,
|
|
|
|
|
FTelephone AS FTelephone,
|
|
|
|
|
FMobilePhone AS FMobilePhone,
|
|
|
|
|
'' AS FQQ,
|
|
|
|
|
'' AS FWeChat,
|
|
|
|
|
'' AS FIdCard,
|
|
|
|
|
'' AS FEmail,
|
|
|
|
|
'' AS FAddress,
|
|
|
|
|
0 AS FProId,
|
|
|
|
|
FPW 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,FState,'BG'
|
|
|
|
|
from TMemberImport
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TMemberImport WHERE FMemNo IN(SELECT FMemNo FROM TMember)
|
|
|
|
|
AND FState = 1
|
|
|
|
|
AND FMemNo NOT IN
|
|
|
|
|
(
|
|
|
|
|
|
|
|
|
|
SELECT FMemNo FROM TMemberImport
|
|
|
|
|
WHERE FMemNo + FMobilePhone IN(SELECT FMemNo + FMobilePhone FROM TMember)
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
UPDATE
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TMemberImport WHERE FMemNo IN(SELECT FMemNo FROM TMember)
|
|
|
|
|
|
|
|
|
|
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,
|
|
|
|
|
FState AS FState,
|
|
|
|
|
FCreateDate AS FCreateDate,
|
|
|
|
|
FExpiredDate AS FExpiredDate,
|
|
|
|
|
FRemainTimes AS FTotalTimes,
|
|
|
|
|
0 AS FUsedTimes,
|
|
|
|
|
FCompId AS FSaleCompId,
|
|
|
|
|
0 AS FSaleBillId,FMemo
|
|
|
|
|
FROM TMemberImport
|
|
|
|
|
|
|
|
|
|
SELECT * FROM #Card WHERE cardid IN
|
|
|
|
|
(
|
|
|
|
|
SELECT fmemNo FROM TMemberImport WHERE FCardTypeId NOT IN(SELECT FId FROM TMemberCardType)
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
INSERT TMemberCardAccount(FId,FMemId,FCardId,FAcctId,FDeposit,FBalance,FArrear,FCreateDate,FExpiredDate,FMemo)
|
|
|
|
|
SELECT dbo.FNNewId(),FMemId AS FMemId,FCardId AS FCardId,3,FBalance,FBalance,0,FCreateDate,FExpiredDate,FMemo
|
|
|
|
|
FROM TMemberImport
|
|
|
|
|
|
|
|
|
|
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,A.FAcctId,getdate(),A.FCardTypeId,A.FCompId,'DR','Import',0,'',A.FBalance,0,A.FBalance,0,getdate(),'<EFBFBD><EFBFBD>Excel<EFBFBD>е<EFBFBD><EFBFBD><EFBFBD>'
|
|
|
|
|
from TMemberImport AS A
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TMember WHERE FMemNo LIKE '%.BG%'
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TMember WHERE FMemNo LIKE '28870%'
|
|
|
|
|
|
|
|
|
|
DELETE TMember WHERE FMemId IN
|
|
|
|
|
(
|
|
|
|
|
SELECT FMemId FROM TMember WHERE FData = 'BG'
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
INSERT TMemberPhoto(FMemId,FType,FImage,FImagePath,FChangeId)
|
|
|
|
|
SELECT FMemId,1,NULL,CAST(FMemId AS VARCHAR(22)) + '_1.jpg',1,cardcode
|
|
|
|
|
|
|
|
|
|
FROM TMember ,mg1..b866_Member WHERE FMemNo = cardcode
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
AND MemberImage != '' AND MemberImage != '\memberphoto\nonphoto.gif'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|