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.
172 lines
2.7 KiB
172 lines
2.7 KiB
1 year ago
|
use qingdao_dieqiao
|
||
|
|
||
|
|
||
|
DROP TABLE TNewMember
|
||
|
DROP TABLE TNewMemberMap
|
||
|
|
||
|
select M.FMemId,M.FMemNo,M.FMobilePhone,C.FCardNo,C.FCardId
|
||
|
INTO TOldCardBak
|
||
|
|
||
|
--SELECT M.*,C.FCardNo,C.FCardId,CAST(0 AS BIGINT ) AS FNewMemId,CAST('' AS VARCHAR(200)) AS FNewMemNo
|
||
|
-- INTO TNewMember
|
||
|
FROM TMember AS M,TMemberCard AS C
|
||
|
WHERE m.FMemId IN
|
||
|
(
|
||
|
SELECT FMemId FROM TMemberCard
|
||
|
GROUP BY FMemId
|
||
|
HAVING(SUM(1) > 1)
|
||
|
)
|
||
|
and m.fmemiD = C.FMemId
|
||
|
--AND m.FMemId IN(SELECT FMemId FROM TConsumeBill)
|
||
|
AND M.FMemNO != C.FCardNo
|
||
|
|
||
|
SELECT * FROM TNewMemberMap WHERE FMemNo = '05236'
|
||
|
|
||
|
SELECT * FROM TNewMemberMap
|
||
|
|
||
|
UPDATE TNewMember SET FNewMemNo = FCardNo ,FNewMemId = dbo.FNNewId()
|
||
|
|
||
|
|
||
|
SELECT FNewMemNo FROM TNewMember
|
||
|
GROUP BY FNewMemNo
|
||
|
HAVING(SUM(1) > 1)
|
||
|
|
||
|
|
||
|
SELECT * FROM TNewMember WHERE FMemNo = '05261'
|
||
|
|
||
|
SELECT * FROM TNewMemberMap WHERE FCardNo = '05261'
|
||
|
|
||
|
INSERT TMember
|
||
|
SELECT * FROM TNewMember
|
||
|
|
||
|
|
||
|
SELECT name + ',' FROM syscolumns WHERE id = object_id('TMember')
|
||
|
|
||
|
INSERT TMember(
|
||
|
FMemId,
|
||
|
FMemNo,
|
||
|
FName,
|
||
|
FBriefCode,
|
||
|
FCompId,
|
||
|
FTypeId,
|
||
|
FIsVisitor,
|
||
|
FCreateDate,
|
||
|
FExpiredDate,
|
||
|
FGender,
|
||
|
FBirthdayType,
|
||
|
FBirthday,
|
||
|
FTelephone,
|
||
|
FMobilePhone,
|
||
|
FQQ,
|
||
|
FWeChat,
|
||
|
FIdCard,
|
||
|
FEmail,
|
||
|
FAddress,
|
||
|
FProId,
|
||
|
FCPW,
|
||
|
FQPW,
|
||
|
FChargeEmpId,
|
||
|
FPoint,
|
||
|
FRecvConsSMS,
|
||
|
FRecvBulkSMS,
|
||
|
FMemo,
|
||
|
FCustom1,
|
||
|
FCustom2,
|
||
|
FCustom3,
|
||
|
FCustom4,
|
||
|
FCustom5,
|
||
|
FState,
|
||
|
FDeleted)
|
||
|
SELECT
|
||
|
FNewMemId,
|
||
|
FNewMemNo,
|
||
|
FName,
|
||
|
FBriefCode,
|
||
|
FCompId,
|
||
|
FTypeId,
|
||
|
FIsVisitor,
|
||
|
FCreateDate,
|
||
|
FExpiredDate,
|
||
|
FGender,
|
||
|
FBirthdayType,
|
||
|
FBirthday,
|
||
|
FTelephone,
|
||
|
FMobilePhone,
|
||
|
FQQ,
|
||
|
FWeChat,
|
||
|
FIdCard,
|
||
|
FEmail,
|
||
|
FAddress,
|
||
|
FProId,
|
||
|
FCPW,
|
||
|
FQPW,
|
||
|
FChargeEmpId,
|
||
|
FPoint,
|
||
|
FRecvConsSMS,
|
||
|
FRecvBulkSMS,
|
||
|
FMemo,
|
||
|
FCustom1,
|
||
|
FCustom2,
|
||
|
FCustom3,
|
||
|
FCustom4,
|
||
|
FCustom5,
|
||
|
FState,
|
||
|
FDeleted
|
||
|
FROM TNewMember
|
||
|
|
||
|
UPDATE A
|
||
|
SET A.FMemId = B.FNewMemId
|
||
|
FROM TMemberCard AS A,TNewMember AS B
|
||
|
WHERE A.FCardId = B.FCardId
|
||
|
|
||
|
|
||
|
UPDATE A
|
||
|
SET A.FMemId = B.FNewMemId
|
||
|
FROM TMemberCardAcctHist AS A,TNewMember AS B
|
||
|
WHERE A.FCardId = B.FCardId
|
||
|
|
||
|
|
||
|
UPDATE A
|
||
|
SET A.FMemId = B.FNewMemId
|
||
|
FROM TMemberOldTransHist AS A,TNewMember AS B
|
||
|
WHERE A.FCardId = B.FCardId
|
||
|
|
||
|
UPDATE A
|
||
|
SET A.FMemId = B.FNewMemId,
|
||
|
A.FMemNo = B.FNewMemNo
|
||
|
FROM TConsumeBill AS A,TNewMember AS B
|
||
|
WHERE A.FCardId = B.FCardId
|
||
|
|
||
|
UPDATE A
|
||
|
SET A.FMemId = B.FNewMemId
|
||
|
FROM TMemberCardAccount AS A,TNewMember AS B
|
||
|
WHERE A.FCardId = B.FCardId
|
||
|
|
||
|
|
||
|
UPDATE A
|
||
|
SET A.FMemId = B.FNewMemId,
|
||
|
A.FMemNo = B.FNewMemNo
|
||
|
FROM TMemberSaleBill AS A,TNewMember AS B
|
||
|
WHERE A.FMemId = 121491
|
||
|
AND A.FMemId = B.FMemId
|
||
|
|
||
|
|
||
|
SELECT * FROM TMemberSaleBill WHERE FMemId IN(SELECT FMemId FROM TNewMember)
|
||
|
|
||
|
UPDATE
|
||
|
|
||
|
|
||
|
SELECT * FROM TConsumeBill WHERE FCardId IN(SELECT FCardId FROM TNewMember)
|
||
|
|
||
|
|
||
|
ALTER TABLE TNewMemberFull ADD FNewMemId
|
||
|
|
||
|
ALTER TABLE TMemberCard ADD FNewMemId BIGINT
|
||
|
|
||
|
SELECT * FROM TMemberCard
|
||
|
|
||
|
UPDATE A
|
||
|
SET A.FMem
|
||
|
|
||
|
|