|
|
|
|
CREATE TABLE #Company
|
|
|
|
|
(
|
|
|
|
|
FCompId BIGINT
|
|
|
|
|
)
|
|
|
|
|
INSERT #Company
|
|
|
|
|
SELECT fiD FROM jinan_fuHANG.DBO.TCompany
|
|
|
|
|
WHERE FNo IN('003')
|
|
|
|
|
|
|
|
|
|
drop table _Repay
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
select * into _MemberCourse FROM jinan_fuHANG.dbo.TMemberCourse WHERE FCompId IN(SELECT FCompId FROM #Company)
|
|
|
|
|
select * into _MemberCourseLog FROM jinan_fuHANG.dbo.TMemberCourseLog WHERE FCardId IN(SELECT FId FROM _MemberCourse)
|
|
|
|
|
select * into _Card FROM jinan_fuHANG.dbo.TMemberCard WHERE FCompId IN(SELECT FCompId FROM #Company)
|
|
|
|
|
select * into _CardAccount FROM jinan_fuHANG.dbo.TMemberCardAccount WHERE FCardId IN(SELECT FCardId FROM _Card)
|
|
|
|
|
select * into _Member FROM jinan_fuHANG.dbo.TMember WHERE FMemId IN(select FMemId FROM _Card UNION ALL SELECT FMemId FROM _MemberCourse)
|
|
|
|
|
select * into _Arrear FROM jinan_fuHANG.dbo.TMemberArrear WHERE FMemId IN(select FMemId FROM _mEMBER)
|
|
|
|
|
select * into _AcctHist FROM jinan_fuHANG.dbo.TMemberCardAcctHist WHERE FMemId IN(select FMemId FROM _mEMBER)
|
|
|
|
|
select * into _PointHist FROM jinan_fuHANG.dbo.TMemberPointHist WHERE FMemId IN(select FMemId FROM _mEMBER)
|
|
|
|
|
|
|
|
|
|
select * into _TransHist FROM jinan_fuHANG.dbo.TMemberTransHist WHERE FMemId IN(select FMemId FROM _mEMBER)
|
|
|
|
|
select * into _TransHistPayment FROM jinan_fuHANG.dbo.TMemberTransHistPayment WHERE FMemId IN(select FMemId FROM _mEMBER)
|
|
|
|
|
select * into _OldTransHist FROM jinan_fuHANG.dbo.TMemberOldTransHist WHERE FMemId IN(select FMemId FROM _mEMBER)
|
|
|
|
|
select * into _OldAcctHist FROM jinan_fuHANG.dbo.TMemberCardOldAcctHist WHERE FMemId IN(select FMemId FROM _mEMBER)
|
|
|
|
|
|
|
|
|
|
select * into _ArrearEmployee FROM jinan_fuHANG.dbo.TMemberArrearEmployee WHERE FMemId IN(select FMemId FROM _mEMBER)
|
|
|
|
|
|
|
|
|
|
select * into _Repay FROM jinan_fuHANG.dbo.TMemberRepay WHERE FMemId IN(select FMemId FROM _mEMBER)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ALTER TABLE _Member ADD FNewMemId BIGINT NOT NULL DEFAULT dbo.FNNewId()
|
|
|
|
|
ALTER TABLE _Card ADD FNewCardId BIGINT NOT NULL DEFAULT dbo.FNNewId()
|
|
|
|
|
ALTER TABLE _MemberCourse ADD FNewId BIGINT NOT NULL DEFAULT dbo.FNNewId()
|
|
|
|
|
ALTER TABLE _Arrear ADD FNewId BIGINT NOT NULL DEFAULT dbo.FNNewId()
|
|
|
|
|
|
|
|
|
|
ALTER TABLE _Member ADD FOldMemId BIGINT NOT NULL DEFAULT 0
|
|
|
|
|
ALTER TABLE _Card ADD FOldCardId BIGINT NOT NULL DEFAULT 0
|
|
|
|
|
ALTER TABLE _MemberCourse ADD FOldId BIGINT NOT NULL DEFAULT 0
|
|
|
|
|
ALTER TABLE _Arrear ADD FOldId BIGINT NOT NULL DEFAULT 0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UPDATE _Member SET FOldMemId = FMemId
|
|
|
|
|
UPDATE _Card SET FOldCardId = FCardId
|
|
|
|
|
UPDATE _MemberCourse SET FOldId = FId
|
|
|
|
|
UPDATE _Arrear SET FOldId = FId
|
|
|
|
|
|
|
|
|
|
SELECT * FROM _Member
|
|
|
|
|
|
|
|
|
|
UPDATE _Member SET FCompId = dbo.FNCompId('003') WHERE FCompId IN(SELECT FCompId FROM #Company)
|
|
|
|
|
UPDATE _Card SET FCompId = dbo.FNCompId('003') WHERE FCompId IN(SELECT FCompId FROM #Company)
|
|
|
|
|
UPDATE _MemberCourse SET FCompId = dbo.FNCompId('003') WHERE FCompId IN(SELECT FCompId FROM #Company)
|
|
|
|
|
UPDATE _MemberCourseLog SET FCompId = dbo.FNCompId('003') WHERE FCompId IN(SELECT FCompId FROM #Company)
|
|
|
|
|
UPDATE _Repay SET FCompId = dbo.FNCompId('003') WHERE FCompId IN(SELECT FCompId FROM #Company)
|
|
|
|
|
UPDATE _TransHist SET FCompId = dbo.FNCompId('003') WHERE FCompId IN(SELECT FCompId FROM #Company)
|
|
|
|
|
UPDATE _AcctHist SET FCompId = dbo.FNCompId('003') WHERE FCompId IN(SELECT FCompId FROM #Company)
|
|
|
|
|
UPDATE _PointHist SET FCompId = dbo.FNCompId('003') WHERE FCompId IN(SELECT FCompId FROM #Company)
|
|
|
|
|
UPDATE _Arrear SET FCompId = dbo.FNCompId('003') WHERE FCompId IN(SELECT FCompId FROM #Company)
|
|
|
|
|
UPDATE _OldTransHist SET FCompId = dbo.FNCompId('003') WHERE FCompId IN(SELECT FCompId FROM #Company)
|
|
|
|
|
UPDATE _OldACCTHIST SET FCompId = dbo.FNCompId('003') WHERE FCompId IN(SELECT FCompId FROM #Company)
|
|
|
|
|
|
|
|
|
|
update A
|
|
|
|
|
SET A.FMemId = B.FNewMemId
|
|
|
|
|
FROM _Card AS A,_Member AS B
|
|
|
|
|
WHERE A.FMemId = B.FMemId
|
|
|
|
|
|
|
|
|
|
update A
|
|
|
|
|
SET A.FMemId = B.FNewMemId
|
|
|
|
|
FROM _MemberCourse AS A,_Member AS B
|
|
|
|
|
WHERE A.FMemId = B.FMemId
|
|
|
|
|
|
|
|
|
|
update A
|
|
|
|
|
SET A.FCardId = B.FNewId
|
|
|
|
|
FROM _MemberCourseLog AS A,_MemberCourse AS B
|
|
|
|
|
WHERE A.FCardId = B.FId
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
update A
|
|
|
|
|
SET A.FCardId = B.FNewCardId
|
|
|
|
|
FROM _CardAccount AS A,_Card AS B
|
|
|
|
|
WHERE A.FCardId = B.FCardId
|
|
|
|
|
|
|
|
|
|
update A
|
|
|
|
|
SET A.FMemId = B.FNewMemId
|
|
|
|
|
FROM _Arrear AS A,_Member AS B
|
|
|
|
|
WHERE A.FMemId = B.FMemId
|
|
|
|
|
|
|
|
|
|
update A
|
|
|
|
|
SET A.FMemId = B.FNewMemId
|
|
|
|
|
FROM _TransHist AS A,_Member AS B
|
|
|
|
|
WHERE A.FMemId = B.FMemId
|
|
|
|
|
|
|
|
|
|
update A
|
|
|
|
|
SET A.FMemId = B.FNewMemId
|
|
|
|
|
FROM _TransHistPayment AS A,_Member AS B
|
|
|
|
|
WHERE A.FMemId = B.FMemId
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
update A
|
|
|
|
|
SET A.FMemId = B.FNewMemId
|
|
|
|
|
FROM _OldTransHist AS A,_Member AS B
|
|
|
|
|
WHERE A.FMemId = B.FMemId
|
|
|
|
|
|
|
|
|
|
update A
|
|
|
|
|
SET A.FMemId = B.FNewMemId
|
|
|
|
|
FROM _OldAcctHist AS A,_Member AS B
|
|
|
|
|
WHERE A.FMemId = B.FMemId
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
update A
|
|
|
|
|
SET A.FCardId = B.FNewCardId
|
|
|
|
|
FROM _Arrear AS A,_Card AS B
|
|
|
|
|
WHERE A.FCardId = B.FCardId
|
|
|
|
|
|
|
|
|
|
update A
|
|
|
|
|
SET A.FMemId = B.FNewMemId
|
|
|
|
|
FROM _ArrearEmployee AS A,_Member AS B
|
|
|
|
|
WHERE A.FMemId = B.FMemId
|
|
|
|
|
|
|
|
|
|
update A
|
|
|
|
|
SET A.FArrearId = B.FNewId
|
|
|
|
|
FROM _ArrearEmployee AS A,_Arrear AS B
|
|
|
|
|
WHERE A.FArrearId = B.FId
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UPDATE _ArrearEmployee SET FId = dbo.FNnewId()
|
|
|
|
|
UPDATE _CardAccount SET FId = dbo.FNnewId()
|
|
|
|
|
UPDATE _MemberCourseLog SET FId = dbo.FNnewId()
|
|
|
|
|
|
|
|
|
|
UPDATE _AcctHist SET FMemo = FMemo + '[<EFBFBD><EFBFBD><EFBFBD><EFBFBD>]'
|
|
|
|
|
UPDATE _TransHist SET FMemo = FMemo + '[<EFBFBD><EFBFBD><EFBFBD><EFBFBD>]'
|
|
|
|
|
UPDATE _MemberCourseLog SET FMemo = FMemo + '[<EFBFBD><EFBFBD><EFBFBD><EFBFBD>]'
|
|
|
|
|
|
|
|
|
|
update A
|
|
|
|
|
SET A.FMemId = B.FNewMemId
|
|
|
|
|
FROM _PointHist AS A,_Member AS B
|
|
|
|
|
WHERE A.FMemId = B.FMemId
|
|
|
|
|
|
|
|
|
|
update A
|
|
|
|
|
SET A.FMemId = B.FNewMemId
|
|
|
|
|
FROM _PointHist AS A,_Member AS B
|
|
|
|
|
WHERE A.FMemId = B.FMemId
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
update A
|
|
|
|
|
SET A.FMemId = B.FNewMemId
|
|
|
|
|
FROM _AcctHist AS A,_Member AS B
|
|
|
|
|
WHERE A.FMemId = B.FMemId
|
|
|
|
|
|
|
|
|
|
update A
|
|
|
|
|
SET A.FCardId = B.FNewCardId
|
|
|
|
|
FROM _AcctHist AS A,_Card AS B
|
|
|
|
|
WHERE A.FCardId = B.FCardId
|
|
|
|
|
|
|
|
|
|
update A
|
|
|
|
|
SET A.FCardId = B.FNewCardId
|
|
|
|
|
FROM _AcctHist AS A,_Card AS B
|
|
|
|
|
WHERE A.FCardId = B.FCardId
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UPDATE _AcctHist SET FId = dbo.FNNewId()
|
|
|
|
|
|
|
|
|
|
update A
|
|
|
|
|
SET A.FMemId = B.FNewMemId
|
|
|
|
|
FROM _TransHist AS A,_Member AS B
|
|
|
|
|
WHERE A.FMemId = B.FMemId
|
|
|
|
|
|
|
|
|
|
update A
|
|
|
|
|
SET A.FCardId = B.FNewCardId
|
|
|
|
|
FROM _TransHist AS A,_Card AS B
|
|
|
|
|
WHERE A.FCardId = B.FCardId
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UPDATE _TransHist SET FId = dbo.FNNewId()
|
|
|
|
|
UPDATE _OldTransHist SET FId = dbo.FNNewId()
|
|
|
|
|
UPDATE _OldAcctHist SET FId = dbo.FNNewId()
|
|
|
|
|
UPDATE _PointHist SET FId = dbo.FNNewId()
|
|
|
|
|
|
|
|
|
|
update A
|
|
|
|
|
SET A.FMemId = B.FNewMemId
|
|
|
|
|
FROM _Repay AS A,_Member AS B
|
|
|
|
|
WHERE A.FMemId = B.FMemId
|
|
|
|
|
|
|
|
|
|
UPDATE _Repay SET FId = dbo.FNNewId()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UPDATE _Member SET FMemId = FNewMemId
|
|
|
|
|
UPDATE _Card SET FCardId = FNewCardId
|
|
|
|
|
UPDATE _MemberCourse SET FId = FNewId
|
|
|
|
|
UPDATE _Arrear SET FId = FNewId
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SELECT A.FMemNO,A.FName,A.FMobilePhone,B.FName,B.FMobilePhone FROM TMember AS A,_mEMBER AS B
|
|
|
|
|
WHERE A.FMemNO = B.FMemNo
|
|
|
|
|
|
|
|
|
|
UPDATE _mEMBER SET FMemNo = 'FH' + FMemNO WHERE FMemNo IN(SELECT FMemNO FROM TMember UNION ALL SELECT FCardNo FROM TMemberCard)
|
|
|
|
|
|
|
|
|
|
UPDATE _Card SET FCardNo = 'FH' + FCardNo WHERE FCardNo IN(SELECT FCardNo FROM TMemberCard UNION ALL SELECT FMemNO FROM TMember)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SELECT * INTO _CardType FROM jinan_fuHANG.dbo.TMemberCardType WHERE FId IN(SELECT FTypeId FROM _Card ) AND FId NOT IN(SELECT FId FROM TMemberCardType)
|
|
|
|
|
UPDATE _CardType SET FNo = 'FH' + FNo
|
|
|
|
|
|
|
|
|
|
EXEC PCopyTable 'TMemberCardType','_CardType ',''
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
INSERT TMemberCardTypeSub(FId,FCompId,FCardTypeId,FAllowSale,FAllowRchg,FENabled)
|
|
|
|
|
SELECT dbo.FNNewId(),C.FId,A.FId,1,1,1
|
|
|
|
|
FROM TCompany AS C,_CardType AS A
|
|
|
|
|
WHERE C.FNo IN('001','003')
|
|
|
|
|
|
|
|
|
|
SELECT * INTO _Item FROM jinan_fuHANG.dbo.TItem WHERE FId IN(SELECT FItemId FROM _MemberCourse ) AND FId NOT IN(SELECT FId FROM TItem)
|
|
|
|
|
UPDATE _Item SET FNo = 'FH' + FNo
|
|
|
|
|
SELECT * INTO _Course FROM jinan_fuHANG.dbo.TCourse WHERE FId IN(SELECT FCourseId FROM _MemberCourse ) AND FId NOT IN(SELECT FId FROM TCourse)
|
|
|
|
|
UPDATE _Course SET FNo = 'FH' + FNo
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
EXEC PCopyTable 'TItem','_Item',''
|
|
|
|
|
EXEC PCopyTable 'TCourse','_Course',''
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
EXEC PCopyTable 'TMember','_Member',' AND FMemId > 0 '
|
|
|
|
|
EXEC PCopyTable 'TMemberCard','_Card',' '
|
|
|
|
|
EXEC PCopyTable 'TMemberCardAccount','_CardAccount',' AND FCardId IN(SELECT FCardId FROM _Card) '
|
|
|
|
|
EXEC PCopyTable 'TMemberCardAcctHist','_AcctHist',' AND FCardId IN(SELECT FCardId FROM _Card) '
|
|
|
|
|
EXEC PCopyTable 'TMemberTransHist','_TransHist',' AND FMemId IN(SELECT FMemId FROM _Member) '
|
|
|
|
|
EXEC PCopyTable 'TMemberCourse','_MemberCourse',' '
|
|
|
|
|
EXEC PCopyTable 'TMemberCourseLog','_MemberCourseLog',' '
|
|
|
|
|
EXEC PCopyTable 'TMemberArrear','_Arrear',' AND FMemId IN(SELECT FMemId FROM _Member) '
|
|
|
|
|
EXEC PCopyTable 'TMemberArrearEmployee','_ArrearEmployee',' AND FMemId IN(SELECT FMemId FROM _Member)'
|
|
|
|
|
EXEC PCopyTable 'TMemberRepay','_Repay',' AND FMemId IN(SELECT FMemId FROM _Member) '
|
|
|
|
|
EXEC PCopyTable 'TMemberPointHist','_PointHist','AND FMemId IN(SELECT FMemId FROM _Member) '
|
|
|
|
|
EXEC PCopyTable 'TMemberOldTransHist','_OldTransHist','AND FMemId IN(SELECT FMemId FROM _Member) '
|
|
|
|
|
EXEC PCopyTable 'TMemberCardOldAcctHIST','_OldAcctHIST','AND FCARDID IN(SELECT FCardid FROM _card) '
|
|
|
|
|
|
|
|
|
|
|