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

46 lines
2.2 KiB

1 year ago
SELECT * FROM MMClient
WHERE FMember != ''
SELECT * FROM MMCard
WHERE FCardState = 'ʹ<EFBFBD><EFBFBD>'
SELECT CASE WHEN FClientName = '' THEN B.FCardNo ELSE FClientName END AS <EFBFBD><EFBFBD><EFBFBD><EFBFBD>,CASE WHEN FMt !='' THEN Fmt ELSE FTel END AS <EFBFBD>ֻ<EFBFBD>,
CASE WHEN Fsex = '<EFBFBD><EFBFBD>' THEN FSex ELSE 'Ů' END AS <EFBFBD>Ա<EFBFBD>,'<EFBFBD><EFBFBD><EFBFBD><EFBFBD>' as <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,'' as <EFBFBD><EFBFBD><EFBFBD><EFBFBD>,
'001' AS <EFBFBD>ŵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,B.FCardNo as <EFBFBD><EFBFBD>Ա<EFBFBD><EFBFBD><EFBFBD><EFBFBD>,'A' + C.FCardTypeNo AS <EFBFBD><EFBFBD>ֵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,B.FBeginDate AS <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,DATEADD(YEAR,100,B.FBeginDate) AS <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,
b.fmoney AS <EFBFBD>˻<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,0 as <EFBFBD>˻<EFBFBD>Ƿ<EFBFBD><EFBFBD>,'' as <EFBFBD>˻<EFBFBD><EFBFBD><EFBFBD>ע ,A.FMember AS <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ע,'' as <EFBFBD>˻<EFBFBD><EFBFBD><EFBFBD>ע,0 ʣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,0 as <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
FROM MMClient AS A,MMCard AS B,MMCardType AS C
WHERE A.FClientSN = B.FClientSN
AND B.FCardState = 'ʹ<EFBFBD><EFBFBD>'
AND B.FCardTypeSN = C.FCardTypeSn
SELECT * FROM MMCardType
SELECT
INSERT INTO qingdao_xiangzuo.dbo.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 FId = qingdao_xiangzuo.dbo.FNNewId(), 'A' + FCardTypeNo,FCardType,1,FMaterial = 2,FSNPrc,FCardFeeAmt = 0,FAcctId = 3,FDeposit = FInitMoney,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 MMCardType
UPDATE MMCardType SET FCardTypeNo = 'A' + FCardTypeNo
ALTER TABLE MMCardType ALTER COLUMN FCardTypeNo VARCHAR(10)
SELECT FCardTypeNo FROM MMCardType
GROUP BY FCardTypeNo
HAVING SUM(1) > 1
INSERT INTO TMemberCardTypeSub(FId,FCompId,FCardTypeId,FAllowSale,FAllowRchg,FEnabled)
SELECT dbo.FNNewId(),C.FId,I.FId,FAllowSale,FAllowRchg,FEnabled
FROM TMemberCardType AS I,TCompany AS C
WHERE I.FId > 1
AND C.FId != 0
AND C.FNo IN( '003','000','002')
AND NOT EXISTS(SELECT TOP 1 1 FROM TMemberCardTypeSub AS B WHERE B.FCompId = C.FId AND B.FCardTypeId = I.FId)