|
|
|
|
use QingDao_saidao11
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- <EFBFBD><EFBFBD><EFBFBD>ݵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 0532UTOPIA
|
|
|
|
|
-- <EFBFBD><EFBFBD><EFBFBD>ݵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> qingdaosaidao11
|
|
|
|
|
|
|
|
|
|
-- Ŀǰ<EFBFBD><EFBFBD><EFBFBD>ݵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> qd77.qingDao_MoDengLishe
|
|
|
|
|
-- Ŀǰ<EFBFBD><EFBFBD><EFBFBD>ݵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> QingDao_saidao11
|
|
|
|
|
|
|
|
|
|
SELECT * FROM qd77.qingDao_MoDengLishe.dbo.TCompany
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CREATE TABLE #Company
|
|
|
|
|
(
|
|
|
|
|
FCompId BIGINT
|
|
|
|
|
)
|
|
|
|
|
INSERT #Company
|
|
|
|
|
SELECT fiD FROM qd77.qingDao_MoDengLishe.DBO.TCompany
|
|
|
|
|
WHERE FNo IN('012')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
--<EFBFBD>ŵ<EFBFBD>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SELECT * INTO #Comp FROM qd77.qingDao_MoDengLishe.dbo.TCompany WHERE FId IN(SELECT FCompId FROM #Company)
|
|
|
|
|
UPDATE #Comp SET FNo = 'FH' + FNo
|
|
|
|
|
EXEC PCopyTable 'TCompany','#Comp',' '
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TCompany
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
--<EFBFBD>û<EFBFBD>
|
|
|
|
|
|
|
|
|
|
EXEC PCopyTable 'TAccessDict','qd77.qingDao_MoDengLishe.dbo.TAccessDict',' AND FKey NOT IN(SELECT FKey FROM TAccessDict)'
|
|
|
|
|
|
|
|
|
|
SELECT *INTO #User FROM qd77.qingDao_MoDengLishe.dbo.TUser
|
|
|
|
|
WHERE 1=1
|
|
|
|
|
AND FId IN(SELECT FUserId FROM qd77.qingDao_MoDengLishe.dbo.TUserAllowCompany WHERE FCompId IN(SELECT FCompId FROM #Company))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UPDATE #User SET FNo = 'FH' + FNo WHERE FNo IN(SELECT FNo FROM TUser)
|
|
|
|
|
EXEC PCopyTable 'TUser','#User',''
|
|
|
|
|
|
|
|
|
|
EXEC PCopyTable 'TRole','qd77.qingDao_MoDengLishe.dbo.TRole','AND FId not in(SELECT FId FROM TRole) AND FId IN(SELECT FRoleId FROM qd77.qingDao_MoDengLishe.dbo.TUserRole WHERE FUserId IN(SELECT FId FROM TUser))'
|
|
|
|
|
EXEC PCopyTable 'TUserRole','qd77.qingDao_MoDengLishe.dbo.TUserRole','AND FId NOT IN(SELECT FId FROM TUserRole) AND FUserId IN(SELECT FId FROM TUser) '
|
|
|
|
|
EXEC PCopyTable 'TRoleAccess','qd77.qingDao_MoDengLishe.dbo.TRoleAccess','AND FRoleId NOT IN(SELECT FRoleId FROM TRoleAccess) AND FRoleId IN(SELECT FId FROM TRole) '
|
|
|
|
|
EXEC PCopyTable 'TUserAllowCompany','qd77.qingDao_MoDengLishe.dbo.TUserAllowCompany',' AND FCompId IN( SELECT FCompId FROM #Company)'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
--ȷ<EFBFBD><EFBFBD>ҪҪ<EFBFBD><EFBFBD><EFBFBD>Ļ<EFBFBD>Ա
|
|
|
|
|
|
|
|
|
|
DROP TABLE #MemberCard
|
|
|
|
|
DROP TABLE #MemberCardD
|
|
|
|
|
DROP TABLE #MemberCourse
|
|
|
|
|
DROP TABLE #MemberCourseD
|
|
|
|
|
DROP TABLE #Member
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
--<EFBFBD><EFBFBD>Ա
|
|
|
|
|
|
|
|
|
|
SELECT *
|
|
|
|
|
INTO #MemberCardI
|
|
|
|
|
FROM qd77.qingDao_MoDengLishe.dbo.TMemberCard WHERE FCompId IN(SELECT FCompId FROM #Company)
|
|
|
|
|
--AND FTypeId IN(SELECT FId FROM TMemberCardType WHERE FNo IN('001','208','202','203','204','207','206','205','210','209'))
|
|
|
|
|
|
|
|
|
|
SELECT *
|
|
|
|
|
INTO #MemberCourseI
|
|
|
|
|
FROM qd77.qingDao_MoDengLishe.dbo.TMemberCourse
|
|
|
|
|
WHERE FCompId IN(SELECT FCompId FROM #Company)
|
|
|
|
|
--AND FPurchaseDate < '2019-08-04'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
--<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ļ<EFBFBD>Ա<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫɾ<EFBFBD><EFBFBD>
|
|
|
|
|
SELECT *
|
|
|
|
|
INTO #MemberCardD
|
|
|
|
|
FROM qd77.qingDao_MoDengLishe.dbo.TMemberCard
|
|
|
|
|
WHERE FCardId NOT IN(SELECT FCardId FROM #MemberCardI)
|
|
|
|
|
AND (FCardId IN(SELECT A.FCardId
|
|
|
|
|
FROM qd77.qingDao_MoDengLishe.DBO.TConsumeBill AS B,qd77.qingDao_MoDengLishe.DBO.TConsumeItemPayment AS A
|
|
|
|
|
WHERE A.FBillId = B.FBillId AND B.FCompId IN(SELECT FCompId FROM #Company) AND A.FCardId > 0 AND B.FMemId > 0
|
|
|
|
|
UNION ALL
|
|
|
|
|
SELECT A.FCardId
|
|
|
|
|
FROM qd77.qingDao_MoDengLishe.DBO.TConsumeBill AS B,qd77.qingDao_MoDengLishe.DBO.TConsumeGoodsPayment AS A
|
|
|
|
|
WHERE A.FBillId = B.FBillId AND B.FCompId IN(SELECT FCompId FROM #Company) AND A.FCardId > 0 AND B.FMemId > 0
|
|
|
|
|
UNION ALL
|
|
|
|
|
SELECT A.FCardId FROM TMemberSaleCard AS A,TMemberSaleBill AS T WHERE T.FBillId = A.FBillId AND T.FCompId IN(SELECT FCompId FROM #Company)
|
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SELECT * INTO #MemberCourseD
|
|
|
|
|
FROM qd77.qingDao_MoDengLishe.dbo.TMemberCourse
|
|
|
|
|
WHERE FId NOT IN(SELECT FId FROM #MemberCourseI)
|
|
|
|
|
AND (FId IN(SELECT A.FMemCourseId
|
|
|
|
|
FROM qd77.qingDao_MoDengLishe.DBO.TConsumeBill AS B,qd77.qingDao_MoDengLishe.DBO.TConsumeItem AS A
|
|
|
|
|
WHERE A.FBillId = B.FBillId AND B.FCompId IN(SELECT FCompId FROM #Company) AND A.FMemCourseId > 0 AND B.FMemId > 0)
|
|
|
|
|
)
|
|
|
|
|
SELECT * INTO #MemberCard
|
|
|
|
|
FROM #MemberCardI
|
|
|
|
|
UNION
|
|
|
|
|
SELECT * FROM #MemberCarDd
|
|
|
|
|
|
|
|
|
|
SELECT * INTO #MemberCourse
|
|
|
|
|
FROM #MemberCourseI
|
|
|
|
|
UNION
|
|
|
|
|
SELECT * FROM #MemberCourseD
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SELECT * INTO #Member
|
|
|
|
|
FROM qd77.qingDao_MoDengLishe.dbo.TMember
|
|
|
|
|
|
|
|
|
|
WHERE FMemId IN(
|
|
|
|
|
SELECT FMemID
|
|
|
|
|
FROM #MemberCard
|
|
|
|
|
UNION ALL
|
|
|
|
|
SELECT FMemId FROM #MemberCourse
|
|
|
|
|
GROUP BY FMemId
|
|
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
--end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
--<EFBFBD>˻<EFBFBD>
|
|
|
|
|
|
|
|
|
|
SELECT * INTO #PayAccount FROM TPayAccount WHERE 1=0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
INSERT #PayAccount(FId,FNo,FName,FDescription,FIsAccount,FAllowEdit,FItemBizRate,FGoodsBizRate,FCardBizRate,FItemPerfRate,FGoodsPerfRate,FCardPerfRate,FItemPointRate,FGoodsPointRate,FCardPointRate,FIsCashIncome,FIsBizIncome,FIsCashPerf,FIsLabor,FCourseIsLabor,FEnabled,FOrder ,FMemberDisplay)
|
|
|
|
|
SELECT FId,FNo,FName,FDescription,FIsAccount,FAllowEdit,FItemBizRate,FGoodsBizRate,FCardBizRate,FItemPerfRate,FGoodsPerfRate,FCardPerfRate,FItemPointRate,FGoodsPointRate,FCardPointRate,FIsCashIncome,FIsBizIncome,FIsCashPerf,FIsLabor,FCourseIsLabor,FEnabled,FOrder ,FMemberDisplay
|
|
|
|
|
FROM qd77.qingDao_MoDengLishe.dbo.TPayAccount WHERE 1=1
|
|
|
|
|
AND FId NOT IN(SELECT FId FROM TPayAccount)
|
|
|
|
|
and FId IN(SELECT A.FAcctId FROM qd77.qingDao_MoDengLishe.dbo.TMemberCardAccount AS A WHERE A.FCardId In(select fcardid from #Membercard))
|
|
|
|
|
|
|
|
|
|
SELECT a.FPayTypeId FROM qd77.qingDao_MoDengLishe.dbo.TConsumeItemPayment AS A,qd77.qingDao_MoDengLishe.dbo.TConsumeBill AS B,#Company AS C WHERE B.FBillId = A.FBillId AND B.FCompId = C.FCompId
|
|
|
|
|
UNION ALL SELECT a.FPayTypeId FROM qd77.qingDao_MoDengLishe.dbo.TConsumeGoodsPayment AS A,qd77.qingDao_MoDengLishe.dbo.TConsumeBill AS B,#Company AS C WHERE B.FBillId = A.FBillId AND B.FCompId = C.FCompId
|
|
|
|
|
UNION ALL SELECT a.FPayTypeId FROM qd77.qingDao_MoDengLishe.dbo.TMemberSalePayment AS A,qd77.qingDao_MoDengLishe.dbo.TMemberSaleBill AS B,#Company AS C WHERE B.FBillId = A.FBillId AND B.FCompId = C.FCompId
|
|
|
|
|
|
|
|
|
|
EXEC PDropColumn 'TPayAccount','FBKAcctId'
|
|
|
|
|
EXEC PDropColumn 'TPayAccount','FBKPayNo'
|
|
|
|
|
|
|
|
|
|
UPDATE #PayAccount SET FNo = 'FH' + FNo
|
|
|
|
|
WHERE FId NOT IN(SELECT FId FROM TPayAccount)
|
|
|
|
|
AND FNo IN(SELECT FNo FROM TPayAccount)
|
|
|
|
|
|
|
|
|
|
-- UPDATE
|
|
|
|
|
|
|
|
|
|
EXEC PCopyTable 'TPayAccount','#PayAccount',''
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
--<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
--<EFBFBD><EFBFBD>Ʒ<EFBFBD><EFBFBD>λ,<EFBFBD><EFBFBD>Ŀ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>,<EFBFBD>ۿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,
|
|
|
|
|
|
|
|
|
|
SELECT * INTO #Unit FROM TBasicType WHERE FKey like 'GoodsUnit'
|
|
|
|
|
AND FId NOT IN(SELECT FUnitId FROM TGoods )
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DROP TABLE #Keys
|
|
|
|
|
|
|
|
|
|
CREATE TABLE #Keys
|
|
|
|
|
(
|
|
|
|
|
FKey VARCHAR(100)
|
|
|
|
|
)
|
|
|
|
|
INSERT #Keys
|
|
|
|
|
SELECT 'ItemType'
|
|
|
|
|
UNION ALL SELECT 'GoodsType'
|
|
|
|
|
UNION ALL SELECT 'ItemDiscountType'
|
|
|
|
|
UNION ALL SELECT 'GoodsDiscountType'
|
|
|
|
|
UNION ALL SELECT 'GoodsUnit'
|
|
|
|
|
UNION ALL SELECT 'Department'
|
|
|
|
|
UNION ALL SELECT 'Position'
|
|
|
|
|
UNION ALL SELECT 'Department'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
INSERT #Keys
|
|
|
|
|
SELECT 'Expenses'
|
|
|
|
|
WHERE EXISTS(SELECT 1 FROM qd77.qingDao_MoDengLishe.dbo.TExpensesBill)
|
|
|
|
|
|
|
|
|
|
INSERT #Keys
|
|
|
|
|
SELECT 'OtherIncome'
|
|
|
|
|
WHERE EXISTS(SELECT 1 FROM qd77.qingDao_MoDengLishe.dbo.TOtherIncomeBill)
|
|
|
|
|
|
|
|
|
|
INSERT #Keys
|
|
|
|
|
SELECT 'Store'
|
|
|
|
|
WHERE EXISTS(SELECT 1 FROM qd77.qingDao_MoDengLishe.dbo.TStockInBill)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
--<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
DROP TABLE #BasicType
|
|
|
|
|
|
|
|
|
|
SELECT * INTO #BasicType FROM qd77.qingDao_MoDengLishe.dbo.TBasicType
|
|
|
|
|
WHERE 1=1
|
|
|
|
|
AND FKey IN(SELECT FKey FROM #Keys) AND FId NOT IN(SELECT FId FROM TBasicType)
|
|
|
|
|
|
|
|
|
|
UPDATE #BasicType SET FNo = 'FH' + FNo WHERE FKey+'-' + FNo IN(SELECT FKey + '-' + FNo FROM TBasicType)
|
|
|
|
|
EXEC PCopyTable 'TBasicType','#BasicType',''
|
|
|
|
|
DROP TABLE #BasicType
|
|
|
|
|
|
|
|
|
|
EXEC PCopyTable 'TBasicTypeSub','qd77.qingDao_MoDengLishe.dbo.TBasicTypeSub',
|
|
|
|
|
' AND FBasicTypeId IN(SELECT FId FROM qd77.qingDao_MoDengLishe.dbo.TBasicType WHERE FKey IN(SELECT FKey FROM #Keys) )
|
|
|
|
|
AND FCompId IN(SELECT 1 UNION ALL SELECT FCompId FROM #Company)
|
|
|
|
|
AND FBasicTypeId NOT IN(SELECT FBasicTypeId FROM TBasicTypeSub)'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
--<EFBFBD><EFBFBD>ֵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
drop table #MemberCardType
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SELECT * INTO #MemberCardType
|
|
|
|
|
FROM qd77.qingDao_MoDengLishe.dbo.TMemberCardType
|
|
|
|
|
WHERE FId > 10
|
|
|
|
|
AND FId IN(SELECT FTypeId FROM #MemberCard )
|
|
|
|
|
|
|
|
|
|
UPDATE #MemberCardType SET FNo = 'AN' + FNo WHERE FNo not like 'AN%' and FNo IN(SELECT FNo FROM TMemberCardType)
|
|
|
|
|
|
|
|
|
|
EXEC PCopyTable 'TMemberCardType','#MemberCardType',' '
|
|
|
|
|
|
|
|
|
|
SELECT * FROM #MemberCardType WHERE FId IN(SELECT FId FROM TMemberCardType)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SELECT * INTO #MemberCardTypeSub
|
|
|
|
|
FROM qd77.qingDao_MoDengLishe.dbo.TMemberCardTypeSub
|
|
|
|
|
WHERE 1=1
|
|
|
|
|
AND FCardTypeId IN (SELECT FId FROM TMemberCardType)
|
|
|
|
|
AND FCardTypeId > 9 AND FCompId IN(SELECT 1 UNION ALL SELECT FCompId FROM #Company)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
EXEC PCopyTable 'TMemberCardTypeSub','#MemberCardTypeSub',' AND CAST(FCompId AS VARCHAR) + CAST(FCardTypeId AS VARCHAR) NOT IN(SELECT CAST(FCompId AS VARCHAR) + CAST(FCardTypeId AS VARCHAR) FROM TMemberCardTYPESUB)'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SELECT * FROM #
|
|
|
|
|
--<EFBFBD><EFBFBD>Ŀ
|
|
|
|
|
drop table #Item
|
|
|
|
|
|
|
|
|
|
SELECT * INTO #Item FROM qd77.qingDao_MoDengLishe.dbo.TItem
|
|
|
|
|
WHERE 1=1
|
|
|
|
|
AND FId NOT IN (SELECT FId FROM TItem)
|
|
|
|
|
AND FId IN(SELECT FItemId FROM #MemberCourse)
|
|
|
|
|
|
|
|
|
|
UPDATE #Item SET FNo = 'AN' + FNo WHERE FNo IN (SELECT FNo FROM TItem)
|
|
|
|
|
|
|
|
|
|
EXEC PCopyTable 'TItem','#Item',' '
|
|
|
|
|
|
|
|
|
|
EXEC PDropColumn 'TItem','FReturnInterval'
|
|
|
|
|
|
|
|
|
|
SELECT * INTO #ItemSub FROM qd77.qingDao_MoDengLishe.dbo.TItemSub
|
|
|
|
|
WHERE 1=1
|
|
|
|
|
AND FId > 0 AND FItemId IN(SELECT FId FROM TItem)
|
|
|
|
|
AND FCompId IN(SELECT 1 UNION ALL SELECT FCompId FROM #Company)
|
|
|
|
|
|
|
|
|
|
EXEC PCopyTable 'TItemSub','#ItemSub',' '
|
|
|
|
|
|
|
|
|
|
update #ItemSub set fallowbooking = 1
|
|
|
|
|
|
|
|
|
|
UPDATE A
|
|
|
|
|
SET A.FNo = 'AN' + B.FNo
|
|
|
|
|
FROM TItem AS A,qd77.qingDao_MoDengLishe.dbo.TItem AS B
|
|
|
|
|
WHERE A.FId = B.FId
|
|
|
|
|
AND A.FId > 0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
drop table #Course
|
|
|
|
|
SELECT * INTO #Course
|
|
|
|
|
FROM qd77.qingDao_MoDengLishe.dbo.TCourse
|
|
|
|
|
WHERE 1=1
|
|
|
|
|
AND FId NOT IN (SELECT FId FROM TCourse ) AND FItemId IN(SELECT FId FROM TItem)
|
|
|
|
|
|
|
|
|
|
--<EFBFBD>Ƴ<EFBFBD>
|
|
|
|
|
UPDATE #Course SET FNo = 'AN' + FNo WHERE FNo IN(SELECT FNo FROM TCourse)
|
|
|
|
|
|
|
|
|
|
EXEC PCopyTable 'TCourse','#Course',' '
|
|
|
|
|
|
|
|
|
|
-- UPDATE #Item
|
|
|
|
|
|
|
|
|
|
UPDATE A
|
|
|
|
|
SET A.FNo = B.FNo
|
|
|
|
|
FROM TCourse AS A,#Item AS B
|
|
|
|
|
WHERE A.FItemId = B.FId
|
|
|
|
|
|
|
|
|
|
SELECT * FROM #Course
|
|
|
|
|
WHERE FNo IN(SELECT FNo FROM TCourse)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
--<EFBFBD><EFBFBD>Ʒ
|
|
|
|
|
SELECT *into #Goods FROM qd77.qingDao_MoDengLishe.dbo.TGoods WHERE FId > 0
|
|
|
|
|
UPDATE #Goods SET FNo = 'HC' + FNo WHERE FNo IN(SELECT FNo FROM TGoods)
|
|
|
|
|
EXEC PCopyTable 'TGoods','#Goods',''
|
|
|
|
|
EXEC PCopyTable 'TGoodsSub','qd77.qingDao_MoDengLishe.dbo.TGoodsSub',' AND FId > 0 AND FCompId IN(SELECT 1 UNION ALL SELECT FCompId FROM #Company)'
|
|
|
|
|
EXEC PCopyTable 'TGoodsMultiUnit','qd77.qingDao_MoDengLishe.dbo.TGoodsMultiUnit',' AND FId > 0 '
|
|
|
|
|
|
|
|
|
|
--Ա<EFBFBD><EFBFBD>
|
|
|
|
|
|
|
|
|
|
SELECT * INTO #Employee FROM qd77.qingDao_MoDengLishe.dbo.TEmployee
|
|
|
|
|
where 1=1
|
|
|
|
|
AND FId IN(SELECT FEmpId FROM qd77.qingDao_MoDengLishe.dbo.TEmployeeSub WHERE FCompID IN(select FCompId FROM #Company))
|
|
|
|
|
|
|
|
|
|
UPDATE #Employee SET FNo= 'HC' + FNo WHERE FId > 0
|
|
|
|
|
and FNo IN(SELECT FNo FROM TEmployee)
|
|
|
|
|
|
|
|
|
|
ALTER TABLE TEmployee
|
|
|
|
|
DROP CONSTRAINT FK_EMPLOYE_ROLE_ID
|
|
|
|
|
|
|
|
|
|
ALTER TABLE TEmployee
|
|
|
|
|
ADD CONSTRAINT FK_EMPLOYE_ROLE_ID FOREIGN KEY (FRoleId)
|
|
|
|
|
REFERENCES TEmployeeRole (FId)
|
|
|
|
|
|
|
|
|
|
EXEC PDropColumn 'TEmployee','FIntroducer'
|
|
|
|
|
|
|
|
|
|
EXEC PCopyTable 'TEmployee','#Employee',' '
|
|
|
|
|
EXEC PCopyTable 'TEmployeeSub','qd77.qingDao_MoDengLishe.dbo.TEmployeeSub',' AND FCompID IN(select FCompId FROM #Company) '
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
--<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
EXEC PCopyTable 'TItemBaseComm','qd77.qingDao_MoDengLishe.dbo.TItemBaseComm',' AND FCompId IN(SELECT 1 UNION ALL select FCompId FROM #Company) '
|
|
|
|
|
EXEC PCopyTable 'TGoodsBaseComm','qd77.qingDao_MoDengLishe.dbo.TGoodsBaseComm',' AND FId > 0 AND FCompId IN(SELECT 1 UNION ALL select FCompId FROM #Company)'
|
|
|
|
|
EXEC PCopyTable 'TMemberCardTypeBaseComm','qd77.qingDao_MoDengLishe.dbo.TMemberCardTypeBaseComm',' AND FId > 0 AND FCompId IN(SELECT 1 UNION ALL select FCompId FROM #Company)'
|
|
|
|
|
EXEC PCopyTable 'TCourseSaleBaseComm','qd77.qingDao_MoDengLishe.dbo.TCourseSaleBaseComm',' AND FId > 0 AND FCompId IN(SELECT 1 UNION ALL select FCompId FROM #Company)'
|
|
|
|
|
EXEC PCopyTable 'TCourseConsBaseComm','qd77.qingDao_MoDengLishe.dbo.TCourseConsBaseComm',' AND FCompId IN(SELECT 1 AS FCompId UNION ALL SELECT FCompId FROM #Company) '
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
--<EFBFBD><EFBFBD>Ŀ<EFBFBD><EFBFBD><EFBFBD>ɷ<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
EXEC PCopyTable 'TItemCommSchemeMaster','qd77.qingDao_MoDengLishe.dbo.TItemCommSchemeMaster',' AND FCompId IN(SELECT 1 AS FCompId UNION ALL SELECT FCompId FROM #Company) '
|
|
|
|
|
EXEC PCopyTable 'TItemCommSchemeMaster','qd77.qingDao_MoDengLishe.dbo.TItemCommSchemeMaster',' AND FId = 0'
|
|
|
|
|
EXEC PCopyTable 'TItemCommSchemeSection','qd77.qingDao_MoDengLishe.dbo.TItemCommSchemeSection',' AND FId = 0 '
|
|
|
|
|
EXEC PCopyTable 'TItemCommSchemeSection','qd77.qingDao_MoDengLishe.dbo.TItemCommSchemeSection',' AND FMasterId IN(SELECT FId FROM TItemCommSchemeMaster) AND FId != 0 '
|
|
|
|
|
EXEC PCopyTable 'TItemCommSchemeDetail','qd77.qingDao_MoDengLishe.dbo.TItemCommSchemeDetail',' AND FMasterId IN(SELECT FId FROM TItemCommSchemeMaster) '
|
|
|
|
|
EXEC PCopyTable 'TItemCommSchemeExcept','qd77.qingDao_MoDengLishe.dbo.TItemCommSchemeExcept',' AND FMasterId IN(SELECT FId FROM TItemCommSchemeMaster) '
|
|
|
|
|
EXEC PCopyTable 'TItemCommSchemeExtra','qd77.qingDao_MoDengLishe.dbo.TItemCommSchemeExtra',' AND FMasterId IN(SELECT FId FROM TItemCommSchemeMaster) '
|
|
|
|
|
|
|
|
|
|
--<EFBFBD><EFBFBD>Ʒ<EFBFBD><EFBFBD><EFBFBD>ɷ<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
EXEC PCopyTable 'TGoodsCommSchemeMaster','qd77.qingDao_MoDengLishe.dbo.TGoodsCommSchemeMaster',' AND FCompId IN(SELECT 1 AS FCompId UNION ALL SELECT FCompId FROM #Company) '
|
|
|
|
|
EXEC PCopyTable 'TGoodsCommSchemeMaster','qd77.qingDao_MoDengLishe.dbo.TGoodsCommSchemeMaster',' AND FId=0 '
|
|
|
|
|
EXEC PCopyTable 'TGoodsCommSchemeSection','qd77.qingDao_MoDengLishe.dbo.TGoodsCommSchemeSection',' AND FId = 0 '
|
|
|
|
|
EXEC PCopyTable 'TGoodsCommSchemeSection','qd77.qingDao_MoDengLishe.dbo.TGoodsCommSchemeSection',' AND FMasterId IN(SELECT FId FROM TGoodsCommSchemeMaster) AND FId != 0 '
|
|
|
|
|
EXEC PCopyTable 'TGoodsCommSchemeDetail','qd77.qingDao_MoDengLishe.dbo.TGoodsCommSchemeDetail',' AND FMasterId IN(SELECT FId FROM TGoodsCommSchemeMaster) AND FId != 0 '
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
--<EFBFBD><EFBFBD>ֵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɷ<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
EXEC PCopyTable 'TCardTypeCommSchemeMaster','qd77.qingDao_MoDengLishe.dbo.TCardTypeCommSchemeMaster',' AND FCompId IN(SELECT 1 AS FCompId UNION ALL SELECT FCompId FROM #Company) '
|
|
|
|
|
EXEC PCopyTable 'TCardTypeCommSchemeSection','qd77.qingDao_MoDengLishe.dbo.TCardTypeCommSchemeSection',' AND FId IN(SELECT FId FROM TCardTypeCommSchemeMaster) '
|
|
|
|
|
EXEC PCopyTable 'TCardTypeCommSchemeDetail','qd77.qingDao_MoDengLishe.dbo.TCardTypeCommSchemeDetail',' AND FId IN(SELECT FId FROM TCardTypeCommSchemeMaster) '
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
--<EFBFBD><EFBFBD>Ŀ<EFBFBD>ۿ<EFBFBD>
|
|
|
|
|
EXEC PCopyTable 'TItemDiscountMaster','qd77.qingDao_MoDengLishe.dbo.TItemDiscountMaster',' AND FCompId IN(select FCompId FROM #Company) '
|
|
|
|
|
EXEC PCopyTable 'TItemDiscountMid','qd77.qingDao_MoDengLishe.dbo.TItemDiscountMid',' AND FParentId IN(SELECT FId FROM TItemDiscountMaster) '
|
|
|
|
|
EXEC PCopyTable 'TItemDiscountDetail','qd77.qingDao_MoDengLishe.dbo.TItemDiscountDetail',' AND FParentId IN(select FId FROM TItemDiscountMid) '
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
--<EFBFBD><EFBFBD>Ʒ<EFBFBD>ۿ<EFBFBD>
|
|
|
|
|
EXEC PCopyTable 'TGoodsDiscountMaster','qd77.qingDao_MoDengLishe.dbo.TGoodsDiscountMaster',' AND FCompId IN(SELECT FCompId FROM #Company) '
|
|
|
|
|
EXEC PCopyTable 'TGoodsDiscountDetail','qd77.qingDao_MoDengLishe.dbo.TGoodsDiscountDetail',' AND FMasterId IN(SELECT FId FROM TGoodsDiscountMaster) '
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
--<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
EXEC PCopyTable 'TBasicDataSyncControl','qd77.qingDao_MoDengLishe.dbo.TBasicDataSyncControl',''
|
|
|
|
|
|
|
|
|
|
EXEC PInitBasicDataSyncControl
|
|
|
|
|
|
|
|
|
|
UPDATE #Member SET FMemNO = 'AN' + FMemNO WHERE FMemNO IN(SELECT FMemNO FROM TMember) OR FMemNo IN(SELECT FCardNo FROM TMemberCard)
|
|
|
|
|
UPDATE #MemberCard SET FCardNo = 'AN' + FCardNo WHERE FCardNo IN(SELECT FCardNo FROM TMemberCard)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SELECT * FROM #MemberCardD
|
|
|
|
|
WHERE FMemId NOT IN(SELECT FMemId FROM TMember)
|
|
|
|
|
|
|
|
|
|
EXEC PDropColumn TMember,PWRESET
|
|
|
|
|
|
|
|
|
|
DELETE TMember WHERE FMemId IN(SELECT FMemId FROM #member)
|
|
|
|
|
|
|
|
|
|
EXEC PCopyTable 'TMember','#Member',' AND FMemId > 0 AND FMemId NOT IN(SELECT FMemID from tmember) '
|
|
|
|
|
EXEC PCopyTable 'TMemberCard','#MemberCard',' AND FCardId > 0 '
|
|
|
|
|
EXEC PCopyTable 'TMemberCardAccount','qd77.qingDao_MoDengLishe.dbo.TMemberCardAccount',' AND FCardId IN(SELECT FCardId FROM #MemberCard) '
|
|
|
|
|
EXEC PCopyTable 'TMemberCardAcctHist','qd77.qingDao_MoDengLishe.dbo.TMemberCardAcctHist',' AND FCardId IN(SELECT FCardId FROM #MemberCard) '
|
|
|
|
|
|
|
|
|
|
SELECT * FROM #MemberCourse WHERE FMemId NOT IN(SELECT FMemId FROM TMember)
|
|
|
|
|
|
|
|
|
|
EXEC PCopyTable 'TMemberCoursePack','qd77.qingDao_MoDengLishe.dbo.TMemberCoursePack',' AND FId IN(SELECT FId FROM #MemberPack)'
|
|
|
|
|
EXEC PCopyTable 'TMemberGoods','qd77.qingDao_MoDengLishe.dbo.TMemberGoods',' AND FMemId IN(SELECT FMemId FROM #Member)'
|
|
|
|
|
EXEC PCopyTable 'TMemberCourse','qd77.qingDao_MoDengLishe.dbo.TMemberCourse',' AND FId IN(SELECT FId FROM #MemberCourse) '
|
|
|
|
|
EXEC PCopyTable 'TMemberCourseLog','qd77.qingDao_MoDengLishe.dbo.TMemberCourseLog',' AND FCardId IN(SELECT FId FROM #MemberCourse) '
|
|
|
|
|
EXEC PCopyTable 'TMemberEmployee','qd77.qingDao_MoDengLishe.dbo.TMemberEmployee',' AND FMemId IN(SELECT FMemId FROM #Member) '
|
|
|
|
|
EXEC PCopyTable 'TMemberPhoto','qd77.qingDao_MoDengLishe.dbo.TMemberPhoto',' AND FMemId IN(SELECT FMemId FROM #Member) '
|
|
|
|
|
EXEC PCopyTable 'TMemberPointHist','qd77.qingDao_MoDengLishe.dbo.TMemberPointHist',' AND FMemId IN(SELECT FMemId FROM #Member)'
|
|
|
|
|
EXEC PCopyTable 'TMemberTransHist','qd77.qingDao_MoDengLishe.dbo.TMemberTransHist',' AND FMemId IN(SELECT FMemId FROM #Member) '
|
|
|
|
|
EXEC PCopyTable 'TMemberTransHistPayment','qd77.qingDao_MoDengLishe.dbo.TMemberTransHistPayment','AND FMemId IN(SELECT FMemId FROM #Member) '
|
|
|
|
|
|
|
|
|
|
EXEC PCopyTable 'TMemberOldTransHist','qd77.qingDao_MoDengLishe.dbo.TMemberOldTransHist',' AND FMemId IN(SELECT FMemId FROM #Member) '
|
|
|
|
|
EXEC PCopyTable 'TMemberCardOldAcctHist','qd77.qingDao_MoDengLishe.dbo.TMemberCardOldAcctHist',' AND FMemId IN(SELECT FMemId FROM #Member) '
|
|
|
|
|
|
|
|
|
|
EXEC PCopyTable 'TMemberArrear','qd77.qingDao_MoDengLishe.dbo.TMemberArrear',' AND FMemId IN(SELECT FMemId FROM #Member) '
|
|
|
|
|
EXEC PCopyTable 'TMemberRepay','qd77.qingDao_MoDengLishe.dbo.TMemberRepay',' AND FMemId IN(SELECT FMemId FROM #Member) '
|
|
|
|
|
EXEC PCopyTable 'TMemberArrearEmployee','qd77.qingDao_MoDengLishe.dbo.TMemberArrearEmployee',' AND FMemId IN(SELECT FMemId FROM #Member) '
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
--<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
EXEC PCopyTable 'TMemberSaleBill','qd77.qingDao_MoDengLishe.dbo.TMemberSaleBill',' AND FCompId In(SELECT FCompId FROM #Company) '
|
|
|
|
|
EXEC PCopyTable 'TMemberSaleCard','qd77.qingDao_MoDengLishe.dbo.TMemberSaleCard',' AND FBillId IN(SELECT FBillId FROM TMemberSaleBill) '
|
|
|
|
|
EXEC PCopyTable 'TMemberSaleCourse','qd77.qingDao_MoDengLishe.dbo.TMemberSaleCourse',' AND FBillId IN(SELECT FBillId FROM TMemberSaleBill) '
|
|
|
|
|
EXEC PCopyTable 'TMemberSaleCourseGoods','qd77.qingDao_MoDengLishe.dbo.TMemberSaleCourseGoods',' AND FBillId IN(SELECT FBillId FROM TMemberSaleBill) '
|
|
|
|
|
EXEC PCopyTable 'TMemberSaleCoursePack','qd77.qingDao_MoDengLishe.dbo.TMemberSaleCoursePack',' AND FBillId IN(SELECT FBillId FROM TMemberSaleBill) '
|
|
|
|
|
EXEC PCopyTable 'TMemberSaleDetailSplit','qd77.qingDao_MoDengLishe.dbo.TMemberSaleDetailSplit',' AND FBillId IN(SELECT FBillId FROM TMemberSaleBill) '
|
|
|
|
|
EXEC PCopyTable 'TMemberSaleEmployee','qd77.qingDao_MoDengLishe.dbo.TMemberSaleEmployee',' AND FBillId IN(SELECT FBillId FROM TMemberSaleBill) '
|
|
|
|
|
EXEC PCopyTable 'TMemberSaleExchange','qd77.qingDao_MoDengLishe.dbo.TMemberSaleExchange',' AND FBillId IN(SELECT FBillId FROM TMemberSaleBill) '
|
|
|
|
|
EXEC PCopyTable 'TMemberSaleExchangeSource','qd77.qingDao_MoDengLishe.dbo.TMemberSaleExchangeSource','AND FBillId IN(SELECT FBillId FROM TMemberSaleBill) '
|
|
|
|
|
EXEC PCopyTable 'TMemberSaleFreeItem','qd77.qingDao_MoDengLishe.dbo.TMemberSaleFreeItem',' AND FBillId IN(SELECT FBillId FROM TMemberSaleBill) '
|
|
|
|
|
EXEC PCopyTable 'TMemberSaleInfo','qd77.qingDao_MoDengLishe.dbo.TMemberSaleInfo',' AND FBillId IN(SELECT FBillId FROM TMemberSaleBill) '
|
|
|
|
|
EXEC PCopyTable 'TMemberSalePayment','qd77.qingDao_MoDengLishe.dbo.TMemberSalePayment',' AND FBillId IN(SELECT FBillId FROM TMemberSaleBill) '
|
|
|
|
|
EXEC PCopyTable 'TMemberSaleRepay','qd77.qingDao_MoDengLishe.dbo.TMemberSaleRepay','AND FBillId IN(SELECT FBillId FROM TMemberSaleBill) '
|
|
|
|
|
EXEC PCopyTable 'TMemberSaleDetailPayment','qd77.qingDao_MoDengLishe.dbo.TMemberSaleDetailPayment','AND FBillId IN(SELECT FBillId FROM TMemberSaleBill) '
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
EXEC PDropColumn 'TConsumeBill','FRoomId'
|
|
|
|
|
|
|
|
|
|
SELECT * FROM qd77.qingDao_MoDengLishe.dbo.TConsumeItemPayment WHERE FBillId = 5571943431087352348
|
|
|
|
|
SELECT * FROM qd77.qingDao_MoDengLishe.dbo.TConsumeItemPayment WHERE FBillId = 5411882309614627079
|
|
|
|
|
|
|
|
|
|
SELECT * FROM qd77.qingDao_MoDengLishe.dbo.TConsumeBill WHERE FCardId NOT IN(SELECT FCardId FROM TMemberCard)
|
|
|
|
|
AND FCompId IN(SELECT FCompId FROM #Company)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TCoursePack
|
|
|
|
|
|
|
|
|
|
SELECT * INTO #MemberPack FROM qd77.qingDao_MoDengLishe.dbo.TMemberCoursePack WHERE FCompId IN(SELECT FCompId FROM #Company)
|
|
|
|
|
|
|
|
|
|
SELECT * INTO #Pack FROM qd77.qingDao_MoDengLishe.dbo.TCoursePack WHERE FId IN(SELECT FPackId FROM #MemberPack)
|
|
|
|
|
EXEC PCopyTable 'TCoursePack','#pack',''
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
--<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
EXEC PCopyTable 'TConsumeBill','qd77.qingDao_MoDengLishe.dbo.TConsumeBill',' AND FCompId IN(SELECT FCompId FROM #Company) '
|
|
|
|
|
EXEC PCopyTable 'TConsumeItem','qd77.qingDao_MoDengLishe.dbo.TConsumeItem',' AND FBillId IN(SELECT FBillId FROM TConsumeBill) '
|
|
|
|
|
EXEC PCopyTable 'TConsumeItemPayment','qd77.qingDao_MoDengLishe.dbo.TConsumeItemPayment',' AND FBillId IN(SELECT FBillId FROM TConsumeBill) '
|
|
|
|
|
EXEC PCopyTable 'TConsumeItemEmployee','qd77.qingDao_MoDengLishe.dbo.TConsumeItemEmployee',' AND FBillId IN(SELECT FBillId FROM TConsumeBill) '
|
|
|
|
|
EXEC PCopyTable 'TConsumeGoods','qd77.qingDao_MoDengLishe.dbo.TConsumeGoods',' AND FBillId IN(SELECT FBillId FROM TConsumeBill) '
|
|
|
|
|
EXEC PCopyTable 'TConsumeGoodsEmployee','qd77.qingDao_MoDengLishe.dbo.TConsumeGoodsEmployee',' AND FBillId IN(SELECT FBillId FROM TConsumeBill) '
|
|
|
|
|
EXEC PCopyTable 'TConsumeGoodsPayment','qd77.qingDao_MoDengLishe.dbo.TConsumeGoodsPayment',' AND FBillId IN(SELECT FBillId FROM TConsumeBill) '
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
EXEC PDROPCOLUMN 'TConsumeItem','FMemComboItemId'
|
|
|
|
|
ALTER TABLE TConsumeItem ADD FMemComboItemId BIGINT
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
--<EFBFBD><EFBFBD>֧
|
|
|
|
|
EXEC PCopyTable 'TOtherIncomeBill','qd77.qingDao_MoDengLishe.dbo.TOtherIncomeBill',' '
|
|
|
|
|
EXEC PCopyTable 'TOtherIncomeDetail','qd77.qingDao_MoDengLishe.dbo.TOtherIncomeDetail',' '
|
|
|
|
|
EXEC PCopyTable 'TOtherIncomePayment','qd77.qingDao_MoDengLishe.dbo.TOtherIncomePayment',' '
|
|
|
|
|
|
|
|
|
|
EXEC PCopyTable 'TExpensesBill','qd77.qingDao_MoDengLishe.dbo.TExpensesBill',' '
|
|
|
|
|
EXEC PCopyTable 'TExpensesDetail','qd77.qingDao_MoDengLishe.dbo.TExpensesDetail',' '
|
|
|
|
|
EXEC PCopyTable 'TExpensesPayment','qd77.qingDao_MoDengLishe.dbo.TExpensesPayment',' '
|
|
|
|
|
|
|
|
|
|
--<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
EXEC PCopyTable 'TInventory','qd77.qingDao_MoDengLishe.dbo.TInventory',' '
|
|
|
|
|
EXEC PCopyTable 'TInventoryLog','qd77.qingDao_MoDengLishe.dbo.TInventoryLog',' '
|
|
|
|
|
|
|
|
|
|
--<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʷ
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
--<EFBFBD><EFBFBD><EFBFBD>ⵥ
|
|
|
|
|
EXEC PCopyTable 'TStockInBill','qd77.qingDao_MoDengLishe.dbo.TStockInBill',' '
|
|
|
|
|
EXEC PCopyTable 'TStockInDetail','qd77.qingDao_MoDengLishe.dbo.TStockInDetail',' '
|
|
|
|
|
|
|
|
|
|
--<EFBFBD><EFBFBD><EFBFBD>ⵥ
|
|
|
|
|
EXEC PCopyTable 'TStockOutBill','qd77.qingDao_MoDengLishe.dbo.TStockOutBill',' '
|
|
|
|
|
EXEC PCopyTable 'TStockOutDetail','qd77.qingDao_MoDengLishe.dbo.TStockOutDetail',' '
|
|
|
|
|
EXEC PCopyTable 'TStockOutDetailBatch','qd77.qingDao_MoDengLishe.dbo.TStockOutDetailBatch',' '
|
|
|
|
|
|
|
|
|
|
--<EFBFBD>̵<EFBFBD>
|
|
|
|
|
EXEC PCopyTable 'TTakeStockBill','qd77.qingDao_MoDengLishe.dbo.TTakeStockBill',' '
|
|
|
|
|
EXEC PCopyTable 'TTakeStockDetail','qd77.qingDao_MoDengLishe.dbo.TTakeStockDetail',' '
|
|
|
|
|
EXEC PCopyTable 'TTakeStockDetailBatch','qd77.qingDao_MoDengLishe.dbo.TTakeStockDetailBatch',' '
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
EXEC PChangeCenterCompany '000'
|
|
|
|
|
|
|
|
|
|
EXEC pcOPYTABLE 'TBizLog','qd77.qingDao_MoDengLishe.dbo.TBizLog',''
|
|
|
|
|
|
|
|
|
|
DECLARE @Sql VARCHAR(MAX)
|
|
|
|
|
SET @SQL = ''
|
|
|
|
|
SELECT @SQL = @SQL + name + ',' FROM syscolumns WHERE id = object_id('TBizLogIndex')
|
|
|
|
|
print @sql
|
|
|
|
|
|
|
|
|
|
ALTER TABLE TBizLog ADD FOldId INT
|
|
|
|
|
|
|
|
|
|
INSERT TBizLog(FOldId,FTime,FCompId,FCompNo,FUserId,FUserNo,FUserName,FFunction,FOperation,FDescription,FContentType,FContent,FIPAddress,FMachineCode,FVersion)
|
|
|
|
|
SELECT FId,FTime,FCompId,FCompNo,FUserId,FUserNo,FUserName,FFunction,FOperation,FDescription,FContentType,FContent,FIPAddress,FMachineCode,FVersion
|
|
|
|
|
FROM qd77.qingDao_MoDengLishe.dbo.TBizLog
|
|
|
|
|
WHERE FCompId IN(SELECT FCompId FROM #Company)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- INSERT TBizLogIndex(FLogId,FKey,FValue)
|
|
|
|
|
-- SELECT A.FId,B.FKey,B.FValue
|
|
|
|
|
-- FROM TBizLog AS A,qd77.qingDao_MoDengLishe.dbo.TBizLogIndex AS B
|
|
|
|
|
-- WHERE A.FOldId = B.FLogId
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
EXEC pcOPYTABLE 'TBizLogIndex','qd77.qingDao_MoDengLishe.dbo.TBizLogIndex',''
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ALTER TABLE [qd77.qingDao_MoDengLishe.dbo.TBizLog] ADD FOldId INT
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SELECT MAX(FId ) FROM TBizLog
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TMemberCardTypeCross
|
|
|
|
|
|
|
|
|
|
DELETE TMemberCardTypeCross
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SELECT * FROM qd77.qingDao_MoDengLishe.dbo.TWeChatAppInfo
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SELECT *INTO _wechatAppInfo FROM TWeChatAppInfo
|
|
|
|
|
SELECT *INTO _wechatAppConfig FROM TWeChatAppConfig
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DELETE twechatAppInfo
|
|
|
|
|
|
|
|
|
|
EXEC PCopyTable 'TwechatAppInfo','qd77.qingDao_MoDengLishe.dbo.TwechatAppInfo',' '
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
EXEC PDropColumn twechatAppInfo, FAliPayAppId
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
--ɾ<EFBFBD><EFBFBD>
|
|
|
|
|
UPDATE TMemberCard SET FDeleted = 1,FCardnO = FCardNo + '<EFBFBD><EFBFBD>AiNiɾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>',FMemo = FMemo + '<EFBFBD><EFBFBD>AiNiɾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>'
|
|
|
|
|
WHERE FCardId IN(SELECT FCardId FROM #MemberCardD)
|
|
|
|
|
AND FDeleted = 0
|
|
|
|
|
AND FMemID > 0
|
|
|
|
|
|
|
|
|
|
UPDATE TMemberCourse SET FDeleted = 1,FMemo = FMemo + '<EFBFBD><EFBFBD>AiNiɾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>'
|
|
|
|
|
WHERE FId IN(SELECT FId FROM #MemberCourseD)
|
|
|
|
|
AND FDeleted = 0
|
|
|
|
|
AND FMemID > 0
|
|
|
|
|
|
|
|
|
|
--ɾ<EFBFBD><EFBFBD>
|
|
|
|
|
UPDATE TMember SET FDeleted = 1,FMemNo = FMemNo + '<EFBFBD><EFBFBD>AiNiɾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>',FMemo = FMemo + '<EFBFBD><EFBFBD>AiNiɾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>'
|
|
|
|
|
WHERE FCompId NOT IN(SELECT FCompId FROM #Company)
|
|
|
|
|
AND FMemID NOT IN(SELECT FMemId FROM TMemberCard WHERE FDeleted = 0)
|
|
|
|
|
AND FMemID NOT IN(SELECT FMemId FROM TMemberCourse WHERE FDeleted = 0)
|
|
|
|
|
AND FMemId IN(SELECT FMemId FROM #MemberCardD UNION ALL SELECT FMemId FROM #MemberCourseD)
|
|
|
|
|
AND FMemID > 0
|
|
|
|
|
AND FDeleted = 0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
--<EFBFBD>ϵ<EFBFBD>
|
|
|
|
|
--ɾ<EFBFBD><EFBFBD>
|
|
|
|
|
|
|
|
|
|
UPDATE qd77.qingDao_MoDengLishe.dbo.TMemberCard
|
|
|
|
|
SET FDeleted = 1,FCardnO = FCardNo + '<EFBFBD><EFBFBD>XingYaoShiGuangɾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>',FMemo = FMemo + '<EFBFBD><EFBFBD>XingYaoShiGuangɾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>'
|
|
|
|
|
WHERE FCardId IN(SELECT FCardId FROM #membercard)
|
|
|
|
|
AND FDeleted = 0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UPDATE qd77.qingDao_MoDengLishe.dbo.TMemberCourse SET FDeleted = 1,FMemo = FMemo + '<EFBFBD><EFBFBD>XingYaoShiGuangɾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>'
|
|
|
|
|
WHERE FId IN(SELECT FId FROM #memberCourse)
|
|
|
|
|
AND FDeleted = 0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
--ɾ<EFBFBD><EFBFBD>
|
|
|
|
|
UPDATE qd77.qingDao_MoDengLishe.dbo.TMember SET FDeleted = 1,FMemNo = FMemNo + '<EFBFBD><EFBFBD>XingYaoShiGuangɾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>',FMemo = FMemo + '<EFBFBD><EFBFBD>0532HuaLiɾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>'
|
|
|
|
|
WHERE FCompId IN(SELECT FCompId FROM #Company)
|
|
|
|
|
AND FMemID NOT IN(SELECT FMemId FROM qd77.qingDao_MoDengLishe.dbo.TMemberCard WHERE FDeleted = 0)
|
|
|
|
|
AND FMemID NOT IN(SELECT FMemId FROM qd77.qingDao_MoDengLishe.dbo.TMemberCourse WHERE FDeleted = 0)
|
|
|
|
|
AND FDeleted = 0
|
|
|
|
|
AND FMemId IN(SELECT FMemId FROM #MemberCard UNION ALL SELECT FMemId FROM #MemberCourse)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UPDATE A
|
|
|
|
|
SET A.FMemNO = B.FMemNo
|
|
|
|
|
FROM TConsumeBill AS A,TMember AS B
|
|
|
|
|
WHERE A.FMemId = B.FMemId
|
|
|
|
|
AND A.FMemId> 0
|
|
|
|
|
AND B.FDeleted = 1
|
|
|
|
|
|
|
|
|
|
UPDATE A
|
|
|
|
|
SET A.FCardNO = B.FCardNO
|
|
|
|
|
FROM TConsumeBill AS A,TMemberCard AS B
|
|
|
|
|
WHERE A.FCardId = B.FCardId
|
|
|
|
|
AND A.FMemId> 0
|
|
|
|
|
AND B.FDeleted = 1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UPDATE A
|
|
|
|
|
SET A.FMemNo = B.FMemNo
|
|
|
|
|
FROM TMemberSaleBill AS A,TMember AS B
|
|
|
|
|
WHERE A.FMemId = B.FMemId
|
|
|
|
|
AND A.FMemId> 0
|
|
|
|
|
AND B.FDeleted = 1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UPDATE A
|
|
|
|
|
SET A.FPayCardno = B.FCardno
|
|
|
|
|
FROM TMemberSaleBill AS A,TMemberCard AS B
|
|
|
|
|
WHERE A.FPayCardId = B.FCardId
|
|
|
|
|
AND A.FPayCardId> 0
|
|
|
|
|
AND B.FDeleted = 1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UPDATE A
|
|
|
|
|
SET A.FMemNO = B.FMemNo
|
|
|
|
|
FROM qd77.qingDao_MoDengLishe.dbo.TConsumeBill AS A,qd77.qingDao_MoDengLishe.dbo.TMember AS B
|
|
|
|
|
WHERE A.FMemId = B.FMemId
|
|
|
|
|
AND A.FMemId> 0
|
|
|
|
|
AND B.FDeleted = 1
|
|
|
|
|
|
|
|
|
|
UPDATE A
|
|
|
|
|
SET A.FCardNO = B.FCardNO
|
|
|
|
|
FROM qd77.qingDao_MoDengLishe.dbo.TConsumeBill AS A,qd77.qingDao_MoDengLishe.dbo.TMemberCard AS B
|
|
|
|
|
WHERE A.FCardId = B.FCardId
|
|
|
|
|
AND A.FMemId> 0
|
|
|
|
|
AND B.FDeleted = 1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UPDATE A
|
|
|
|
|
SET A.FMemNo = B.FMemNo
|
|
|
|
|
FROM qd77.qingDao_MoDengLishe.dbo.TMemberSaleBill AS A,qd77.qingDao_MoDengLishe.dbo.TMember AS B
|
|
|
|
|
WHERE A.FMemId = B.FMemId
|
|
|
|
|
AND A.FMemId> 0
|
|
|
|
|
AND B.FDeleted = 1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UPDATE A
|
|
|
|
|
SET A.FPayCardno = B.FCardno
|
|
|
|
|
FROM qd77.qingDao_MoDengLishe.dbo.TMemberSaleBill AS A,qd77.qingDao_MoDengLishe.dbo.TMemberCard AS B
|
|
|
|
|
WHERE A.FPayCardId = B.FCardId
|
|
|
|
|
AND A.FPayCardId> 0
|
|
|
|
|
AND B.FDeleted = 1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|