SELECT * FROM TIMpMember1 SELECT * FROM TIMpMember2 SELECT * FROM TImpMember2 SELECT FName,SUM(1) FROM TMemberCardType GROUP BY FName ORDER BY SUM(1) SELECT * FROM Member_CardType SELECT * FROM Member_CardInfo WHERE vhrCardNo = '000001' SELECT * FROM Member_Account WHERE vhrMemberCardNo = '000001' SELECT * FROM Member_Info WHERE intId = 2442 SELECT * FROM Member_AccountDetail WHERE vhrMemberCardNo = '000001' ALTER TABLE TImpMember2 ADD FMemId BIGINT ALTER TABLE TImpMember2 ADD FCardNo VARCHAR(50) ALTER TABLE TImpMember2 ADD FMemNo VARCHAR(50) ALTER TABLE TImpMember2 ADD FName VARCHAR(50) ALTER TABLE TImpMember2 ADD FGender INT ALTER TABLE TImpMember2 ADD FMobile VARCHAR(50) ALTER TABLE TImpMember2 ADD FTelephone VARCHAR(50) ALTER TABLE TImpMember2 ADD FCardTypeId BIGINT ALTER TABLE TImpMember2 ADD FCourseId BIGINT ALTER TABLE TImpMember2 ADD FBalance DECIMAL(18,6) ALTER TABLE TImpMember2 ADD FRemainTimes INT ALTER TABLE TImpMember2 ADD FPurTimes INT ALTER TABLE TImpMember2 ADD FPurAmount DECIMAL(18,6) ALTER TABLE TImpMember2 ADD FItemId BIGINT ALTER TABLE TImpMember2 ADD FCreateDate DATETIME ALTER TABLE TImpMember2 ADD FExpiredDate DATETIME ALTER TABLE TImpMember2 ADD FCompId BIGINT ALTER TABLE TImpMember2 ADD FCardId BIGINT ALTER TABLE TImpMember2 ADD FMemo VARCHAR(1000) ALTER TABLE TImpMember2 ADD FArrear DECIMAL(18,6) ALTER TABLE TImpMember2 ADD FPoint DECIMAL(18,6) ALTER TABLE TImpMember2 ADD FBirthday DATETIME ALTER TABLE TImpMember2 ADD FBirthdayType CHAR ALTER TABLE TImpMember2 ADD FState INT ALTER TABLE TImpMember2 ADD FDeleted BIT DEFAULT 0 NOT NULL UPDATE TImpMember2 SET FMemNo = »áÔ±¿¨ºÅ UPDATE TImpMember2 SET FCardNO = FMemNo UPDATE TImpMember2 SET FMemId = dbo.FNNewId() WHERE FMemid IS NULL UPDATE TImpMember2 SET FCardId = dbo.FNNewId() WHERE FCardId IS NULL UPDATE TImpMember2 SET FName = ÐÕÃû UPDATE TImpMember2 SET FGender = CASE WHEN ÐÔ±ð='ÄÐ' THEN 1 ELSE '0' END UPDATE TImpMember2 SET FBalance = Óà¶î UPDATE TImpMember2 SET FState = 4,FMemo = FMemo + 'ÀÏϵͳÖÐÏÔʾÒÑ»»¿¨' WHERE ISNULL(״̬,'') = '»»¿¨' UPDATE TImpMember2 SET FState = 5 WHERE ISNULL(״̬,'') = '¹Òʧ' UPDATE TImpMember2 SET FPoint = »ý·Ö UPDATE A SET A.FMobile = ISNULL(B.vhrMobilePhone,B.vhrTel) FROM TImpMember2 AS A,Member_Info AS B,Member_CardInfo AS C WHERE A.FMemNo = C.vhrCardNo AND B.intId = C.intMemberId UPDATE A SET A.FTelephone = ISNULL(B.vhrTel,'') FROM TImpMember2 AS A,Member_Info AS B,Member_CardInfo AS C WHERE A.FMemNo = C.vhrCardNo AND B.intId = C.intMemberId AND ISNULL(A.FMobile,'') = '' UPDATE A SET A.FCreateDate = B.dtmCreateTime, A.FMemo = ISNULL(B.txtRemark,''), A.FExpiredDate = ISNULL(b.dtmLiftTerminateTime,'9999-01-01') FROM TImpMember2 AS A,Member_CardInfo AS B WHERE A.FCardNO = B.vhrCardNo UPDATE A SET A.FCardTypeId = B.FId FROM TImpMember2 AS A,TMemberCardType AS B WHERE A.¿¨ÀàÐÍ = B.FName SELECT * FROM TIMpMember2 WHERE FCardNO IN(SELECT ±àºÅ FROM TIMpMember) Lift Terminate ALTER TABLE TImpMember3 ADD FMemiD BIGINT ALTER TABLE TImpMember1 ADD FMemiD BIGINT UPDATE A SET A.FMemId = B.FMemid FROM TImpMember1 AS A,TImpMember AS B WHERE A.±àºÅ = B.±àºÅ UPDATE A SET A.FMemId = B.FMemid FROM TImpMember3 AS A,TImpMember AS B WHERE A.±àºÅ = B.±àºÅ UPDATE A SET A.±àºÅ = B.±àºÅ, A.FMemNo = B.±àºÅ, A.FCardNO = b.±àºÅ FROM TImpMember AS A,TImpMember3 AS B WHERE A.FMemId = B.FMemId UPDATE A SET A.±àºÅ = B.±àºÅ, A.FMemNo = B.±àºÅ, A.FCardNO = b.±àºÅ FROM TImpMember AS A,TImpMember1 AS B WHERE A.FMemId = B.FMemId UPDATE TImpMember3 SET ±àºÅ = REPLACE(±àºÅ,'_3','') UPDATE TImpMember1 SET ±àºÅ = REPLACE(±àºÅ,'_1','') UPDATE TImpMember SET ±àºÅ = REPLACE(±àºÅ,'_1','') UPDATE TImpMember SET ±àºÅ = REPLACE(±àºÅ,'_3','') UPDATE TImpMember3 SET ±àºÅ = ±àºÅ + '_3' WHERE ±àºÅ IN(SELECT FMemNo FROM TImpMember2) UPDATE TImpMember1 SET ±àºÅ = ±àºÅ + '_1' WHERE ±àºÅ IN(SELECT FMemNo FROM TImpMember2) UPDATE TImpMember2 SET FMemNo = FMemNo + '_2' WHERE »áÔ±¿¨ºÅ IN(SELECT ±àºÅ FROM TImpMember ) UPDATE TImpMember2 SET FCardNo = FMemNo SELECT * FROM TImpMember2 WHERE FName IS NULL DELETE TImpMember2 WHERE FName IS NULL select * from TImpMember3 UPDATE A SET A.FMemNo = B.FMemNo FROM TMember AS A,TImpMember AS B WHERE A.FMemId = B.FMemId UPDATE A SET A.FCardNO = B.FCardNO FROM TMemberCard AS A,TImpMember AS B WHERE A.FCardId = B.FCardId --¿ªÊ¼ 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, 1 AS FCompId, ISNULL(FCreateDate ,'1900-01-01') AS FCreateDate, FGender AS FGender, 'G' AS FBirthdayType, FBirthday AS FBirthday, ISNULL(FTelephone,'') 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( 0,0) AS FPoint, 1 AS FRecvConsSMS, 1 AS FRecvBulkSMS, ISNULL('','') AS FMemo, '' AS FCustom1,'' AS FCustom2,'' AS FCustom3,'' AS FCustom4,'' AS FCustom5 from TImpMember2 --µ¼¿¨ 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, 1 AS FCompId, FMemId AS FMemId, ISNULL(FState ,1)AS FState, ISNULL(FCreateDate,1900) AS FCreateDate, ISNULL(FExpiredDate,'9999-01-01'), 0 AS FTotalTimes, 0 AS FUsedTimes, 1 AS FSaleCompId, 0 AS FSaleBillId, ISNULL(FMemo,'') AS FMemo FROM TImpMember2 INSERT TMemberCardAccount(FMemId,FId,FCardId,FAcctId,FDeposit,FBalance,FArrear,FCreateDate,FExpiredDate,FMemo) SELECT FMemId,dbo.FNNewId(),FCardId AS FCardId,3,ISNULL(FBalance,0),ISNULL(FBalance,0),0,FCreateDate,DATEADD(year,100, FCreateDate) AS FExpiredDate,'' FROM TImpMember2 AS A WHERE FBalance IS NULL 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,1,'DR','Import',0,'',ISNULL(A.FBalance,0),0,ISNULL(A.FBalance,0),0,getdate(),'' FROM TImpMember2 AS A SELECT * FROM TMember --End OF 2 -------------------------------------------------------------------------- DROP TABLE TIMpMember1 DROP TABLE TIMpMember3 DROP TABLE TImpMember SELECT * INTO TImpMember FROM TImpMember1 WHERE 1=0 -- UPDATE TIMpMember1 SET ¿¨Æ¬Ãû = ¿¨Æ¬Ãû + '1' WHERE ¿¨Æ¬Ãû = '´¢Öµ¿¨' UPDATE TIMpMember3 SET ¿¨Æ¬Ãû = ¿¨Æ¬Ãû + '1' WHERE ¿¨Æ¬Ãû = '´¢Öµ¿¨' SELECT ±àºÅ INTO #Member1 FROM TIMpMember1 WHERE ±àºÅ IN(SELECT ±àºÅ FROM TIMpMember3) SELECT ±àºÅ INTO #Member3 FROM TIMpMember3 WHERE ±àºÅ IN(SELECT ±àºÅ FROM TIMpMember1) UPDATE TIMpMember1 SET ±àºÅ = ±àºÅ + '_1' WHERE ±àºÅ IN(SELECT ±àºÅ FROM #Member1) UPDATE TIMpMember3 SET ±àºÅ = ±àºÅ + '_3' WHERE ±àºÅ IN(SELECT ±àºÅ FROM #Member1) INSERT TImpMember SELECT * FROM TIMpMember1 INSERT TImpMember SELECT * FROM TIMpMember3 SELECT * FROM TImpMember1 WHERE ±àºÅ = '900539' SELECT * FROM TImpMember3 WHERE ±àºÅ = '900539' UPDATE TImpMember SET ±àºÅ = ±àºÅ + '_1' SELECT FMemNo ,SUM(1) FROM TImpMember GROUP BY FMemNo HAVING(SUM(1) > 1) 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 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 DEFAULT 0 NOT NULL SELECT * FROM TImpMember UPDATE TImpMember SET FCompID = 1 UPDATE TImpMember SET FMemNo = ±àºÅ UPDATE TImpMember SET FCardNO = FMemNo UPDATE TImpMember SET FMemId = dbo.FNNewId() WHERE FMemid IS NULL UPDATE TImpMember SET FCardId = dbo.FNNewId() WHERE FCardId IS NULL UPDATE TImpMember SET FName = ÐÕÃû UPDATE TImpMember SET FGender = CASE WHEN ÐÔ±ð='ÄÐ' THEN 1 ELSE '0' END UPDATE TImpMember SET FBalance = ½ð¶î --UPDATE TImpMember SET FDeleted = 1 WHERE ISNULL(״̬,'') = '»»¿¨' UPDATE TImpMember SET FPoint = Ê£Óà»ý·Ö UPDATE TImpMember SET FBirthdayType = 'G' UPDATE TImpMember SET FBirthday = NULL UPDATE TImpMember SET FMobile = µç»° UPDATE TImpMember SET FCreateDate = °ì¿¨Ê±¼ä UPDATE TImpMember SET FExpiredDate = ÓÐЧÆÚ UPDATE TImpMember SET FMemo = ±¸×¢ UPDATE A SET A.FCardTypeId = B.FId FROM TImpMember AS A,TMemberCardType AS B WHERE A.¿¨Æ¬Ãû = B.FName SELECT * FROM TIMpMember WHERe ¿¨×´Ì¬ != 1 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, 1 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( 0,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, FCardNo AS FNo, FCardNo AS FFaceNo, FCardTypeId AS FTypeId, (SELECT FValueType FROM TMemberCardType WHERE FId = FCardTypeId) AS FValueType, 1 AS FCompId, FMemId AS FMemId, 1 AS FState, ISNULL(FCreateDate,1900) AS FCreateDate, ISNULL(FExpiredDate,'9999-01-01'), 0 AS FTotalTimes, 0 AS FUsedTimes, 1 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,DATEADD(year,100, FCreateDate) AS FExpiredDate,'' FROM TImpMember AS A 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,1,'DR','Import',0,'',A.FBalance,0,A.FBalance,0,getdate(),'' FROM TImpMember AS A --------------------------------------------------------------------------- SELECT ¿¨ÀàÐÍ FROM TImpMember2 GROUP BY ¿¨ÀàÐÍ SELECT ¿¨Æ¬Ãû FROM TImpMember1 GROUP BY ¿¨Æ¬Ãû SELECT ¿¨Æ¬Ãû FROM TImpMember3 GROUP BY ¿¨Æ¬Ãû INSERT TMemberCardType(FId,FNo,FName,FValueType,FMaterial,FPrice,FAcctId,FDeposit,FAcctId2,FDeposit2,FAcctId3,FDeposit3,FTimes,FAlertBalance,FMinRchgAmt,FValidityPeriod,FValidityPeriodUnit,FExpiredDate,FDefaultMemo,FEnabled,FOrder,FSalePointMode,FSalePointValue,FRchgPointMode,FRchgPointValue) SELECT dbo.FNNewId(),'20-' + ¿¨ÀàÐÍ,¿¨ÀàÐÍ,1,2,0,3,0,0,0,0,0,0,0,0,0,0,'9999-12-31','',1,0,0,0,0,0 FROM TImpMember2 GROUP BY ¿¨ÀàÐÍ INSERT TMemberCardType(FId,FNo,FName,FValueType,FMaterial,FPrice,FAcctId,FDeposit,FAcctId2,FDeposit2,FAcctId3,FDeposit3,FTimes,FAlertBalance,FMinRchgAmt,FValidityPeriod,FValidityPeriodUnit,FExpiredDate,FDefaultMemo,FEnabled,FOrder,FSalePointMode,FSalePointValue,FRchgPointMode,FRchgPointValue) SELECT dbo.FNNewId(),'10-' + ¿¨Æ¬Ãû,¿¨Æ¬Ãû,1,2,0,3,0,0,0,0,0,0,0,0,0,0,'9999-12-31','',1,0,0,0,0,0 FROM TImpMember1 GROUP BY ¿¨Æ¬Ãû INSERT TMemberCardType(FId,FNo,FName,FValueType,FMaterial,FPrice,FAcctId,FDeposit,FAcctId2,FDeposit2,FAcctId3,FDeposit3,FTimes,FAlertBalance,FMinRchgAmt,FValidityPeriod,FValidityPeriodUnit,FExpiredDate,FDefaultMemo,FEnabled,FOrder,FSalePointMode,FSalePointValue,FRchgPointMode,FRchgPointValue) SELECT dbo.FNNewId(),'30-' + ¿¨Æ¬Ãû,¿¨Æ¬Ãû,1,2,0,3,0,0,0,0,0,0,0,0,0,0,'9999-12-31','',1,0,0,0,0,0 FROM TImpMember3 GROUP BY ¿¨Æ¬Ãû