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.
 
 
 
 
 

224 lines
6.9 KiB

INSERT ChongQing_JueGongGuoJi..TMemberCardType(FId,FNo,FName,FValueType,FMaterial,FPrice,FAcctId,FDeposit,FAcctId2,FDeposit2,FAcctId3,FDeposit3,FTimes,FAlertBalance,FMinRchgAmt,FValidityPeriod,FValidityPeriodUnit,FAllowSale,FAllowRchg,FEnabled,FOrder,FSalePointMode,FSalePointValue,FRchgPointMode,FRchgPointValue)
SELECT CardTypeId = CardTypeId,
CardTypeId = CardTypeId,
CardTypeName AS FName,
1 AS FValueType,
2 AS FMaterial,
0 AS FPrice,
3 AS FAcctId,
0 AS FDeposit,
0 as FAcctId2,
0 AS FDeposit2,
0 AS FAcctId3,
0 AS FDeposit3,
0 AS FTimes,
0 AS FAlertBalance,
0 AS FMinRchgAmt,
0 AS FValidityPeriod,
0 AS FValidityPeriodUnit,
0 AS FAllowSale,
0 AS FAllowRchg,
1,
1,
0 AS FSalePointMode,
0 AS FSalePointValue,
0 AS FRchgPointMode,
0 AS FRchgPointValue
FROM sh_cardType
UPDATE sh_guest SET FCardId = ChongQing_JueGongGuoJi.dbo.FNNewId()
DROP TABLE TImpMember
SELECT M.FMemId AS FMemId,
MIN(C.CardId) AS FMemNo,
M.FCardId AS FCardId,
M.guestName AS FName,
M.GuestMove AS FMobile,
M.GuestSex AS FGender,
B.SaveMoney AS FBalance,
M.RecordTime AS FCreateDate,
B.CardTypeId AS FCardTypeId
INTO TImpMember
FROM sh_guest AS M,sh_card AS C,sh_account AS B
WHERE M.guestId = C.PeopleId
AND B.guestId = M.GuestId
GROUP BY M.FMemId,M.FCardId,M.guestName, M.GuestMove, M.GuestSex,B.SaveMoney,M.RecordTime , B.CardTypeId
SELECT FMemId,SUM(1) FROM TImpMember GROUP BY FMemId HAVING(SUM(1) > 1)
SELECT * FROM TImpMember WHERE FMemId = 5115776472806431470
UPDATE TImpMember SET FMemNo = 'ST' + FMemNo
SELECT * FROM ChongQing_JueGongGuoJi..TMemberCard
SELECT * FROM ChongQing_JueGongGuoJi..TCompany
INSERT INTO ChongQing_JueGongGuoJi.dbo.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 FId,
FMemNo AS FNo,
FName AS FName,
'' FBriefCode,
0 AS FTypeId,
3472330288284041216 AS FCompId,
FCreateDate AS FCreateDate,
FGender AS FGender,
'G' AS FBirthdayType,
NULL AS FBirthday,
'' AS FTelephone,
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
WHERE FMemId IN (SELECT FMemId FROM ChongQing_JueGongGuoJi.dbo.TMember)
INSERT INTO ChongQing_JueGongGuoJi..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,
1,
1 AS FCompId,
FMemId AS FMemId,
1 AS FState,
FCreateDate AS FCreateDate,
dateadd(yy,100,FCreateDate) AS FExpiredDate,
0 AS FTotalTimes,
0 AS FUsedTimes,
0 AS FSaleCompId,
0 AS FSaleBillId,
'' AS FMemo
FROM TImpMember
INSERT ChongQing_JueGongGuoJi..TMemberCardAccount(FMemId,FId,FCardId,FAcctId,FDeposit,FBalance,FArrear,FCreateDate,FExpiredDate,FMemo)
SELECT FMemId,ChongQing_JueGongGuoJi.dbo.FNNewId(),FCardId AS FCardId,3,FBalance,FBalance,0,FCreateDate,NULL,''
FROM TImpMember
INSERT ChongQing_JueGongGuoJi..TMemberCardAcctHist(FId,FMemId,FCardId,FAcctId,FTime,FCardTypeId,FCompId,FBillType,FBizType,FTransId,FTransNo,FInAmount,FOutAmount,FBalance,FArrear,FRecordTime,FMemo)
select ChongQing_JueGongGuoJi.dbo.FNNewId(), FMemId, FCardId,3,getdate(), FCardTypeId,3472330288284041216,'DR','Import',0,'', FBalance,0, FBalance,0,getdate(),''
from TImpMember
UPDATE ChongQing_JueGongGuoJi..TMemberCardAccount
SET FAcctId = 7462859093971055089
WHERE FAcctId = 3
AND FMemId IN(SELECT FMemID FROM TImpMember)
UPDATE ChongQing_JueGongGuoJi..TMemberCardAcctHist
SET FAcctId = 7462859093971055089
WHERE FAcctId = 3
AND FMemId IN(SELECT FMemID FROM TImpMember)
SELECT * FROM ChongQing_JueGongGuoJi..TPAyAccount
SELECT * FROM sh_cardType
SELECT * FROM sh_guest
SELECT * FROM ChongQing_JueGongGuoJi..TMemberCard
UPDATE A
SET A.FCompId = B.FCompId
FROM ChongQing_JueGongGuoJi..TMemberCard AS A, ChongQing_JueGongGuoJi..TMember AS B
WHERE A.FMemId = B.FMemId
AND B.FMemno LIKE 'ST%'
SELECT * FROM TCompany
SELECT* FROM TMemberCard WHERE FTypeId = 1
SELECT * FROM ChongQing_JueGongGuoJi.. TMemberCardType WHERE FId = 1
UPDATE ChongQing_JueGongGuoJi.. TMemberCardType SET FNo = FNo
UPDATE ChongQing_JueGongGuoJi.. TMemberCardType SET FNo = 'ST' + FNo WHERE Fid < 100
SELECT *INTO #Card from TMemberCard WHERE FCardNo LIKE 'ST%'
UPDATE TMemberCard SET FCompId = 3472331387795668992 WHERE FCardId NOT IN(SELECT FCardId FROM #Card)
UPDATE TMemberCardAcctHist SET FCompId = 3472331387795668992 WHERE FCardId NOT IN(SELECT FCardId FROM #Card)
UPDATE ChongQing_JueGongGuoJi.. TMemberCardType
SET FID = 1 + FId WHERE FId < 1000
SELECT * FROM ChongQing_JueGongGuoJi.. TMemberCardType
UPDATE ChongQing_JueGongGuoJi.. T SET FId = 0 WHERE FId = 1000
UPDATE ChongQing_JueGongGuoJi.. TMemberCard SET FTypeId = 0 WHERE FTypeId = 1000
UPDATE ChongQing_JueGongGuoJi.. TMemberCardType SET FAllowRchg = 1
UPDATE ChongQing_JueGongGuoJi.. TMemberCardTypeSub
SET FCardTypeId = 1000 + FCardTypeId WHERE FCardTypeId < 1000
UPDATE ChongQing_JueGongGuoJi.. TMemberCard
SET FTypeId = 1000 + FTypeId WHERE FTypeId < 1000
UPDATE ChongQing_JueGongGuoJi.. TMemberCardAcctHist
SET FCardTypeId = 1000 + FCardTypeId WHERE FCardTypeId < 1000