|
|
|
|
|
|
|
|
|
DROP TABLE #Company
|
|
|
|
|
|
|
|
|
|
SELECT FId AS FCompId INTO #Company
|
|
|
|
|
FROM TCompany
|
|
|
|
|
WHERE FNo IN('005','006','007')
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TMember WHERE FDeleted = 0
|
|
|
|
|
AND FMemId IN(SELECT FMemId FROM TMemberCard WHERE FDeleted = 1)
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TMemberCard WHERE FMemId = 9081333813291210871
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TCompany WHERE FId = 3472330288284041216
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TCompany
|
|
|
|
|
SELECT * FROM TMemberCard
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TMember WHERE FCompID = 1
|
|
|
|
|
|
|
|
|
|
UPDATE TCompany SET FNo = FNo + '<EFBFBD><EFBFBD>ɾ' ,FDeleted = 1
|
|
|
|
|
WHERE FId IN(SELECT FCompId FROM #Company)
|
|
|
|
|
|
|
|
|
|
--ɾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><EFBFBD>
|
|
|
|
|
UPDATE TMemberCard SET FCardNo = FCardNo + '<EFBFBD><EFBFBD>ɾ' ,FDeleted = 1
|
|
|
|
|
WHERE FCompId IN(SELECT FCompId FROM #Company)
|
|
|
|
|
|
|
|
|
|
--ɾ<EFBFBD><EFBFBD><EFBFBD>Ƴ<EFBFBD>
|
|
|
|
|
UPDATE TMemberCourse SET FDeleted = 1
|
|
|
|
|
WHERE FCompId IN(SELECT FCompId FROM #Company)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
--<EFBFBD><EFBFBD>ɢ<EFBFBD><EFBFBD>ɾ<EFBFBD><EFBFBD>
|
|
|
|
|
UPDATE TMember SET FMemNo = FMemNO + '<EFBFBD><EFBFBD>ɾ' ,FDeleted = 1
|
|
|
|
|
WHERE FCompId IN(SELECT FCompId FROM #Company)
|
|
|
|
|
AND FIsVisitor = 1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
--<EFBFBD><EFBFBD>û<EFBFBD>п<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵĻ<EFBFBD>Աɾ<EFBFBD><EFBFBD>
|
|
|
|
|
UPDATE TMember SET FMemNo = FMemNO + '<EFBFBD><EFBFBD>ɾ' ,FDeleted = 1
|
|
|
|
|
WHERE FCompId IN(SELECT FCompId FROM #Company)
|
|
|
|
|
AND FMemId NOT IN(SELECT FMemId FROM TMemberCard WHERE FDeleted = 0 UNION ALL SELECT FMemId FROM TMemberCourse WHERE FDeleted = 0 )
|
|
|
|
|
AND FIsVisitor = 0
|
|
|
|
|
|
|
|
|
|
--<EFBFBD><EFBFBD><EFBFBD>»<EFBFBD>Ա<EFBFBD>Ĺ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ŵ<EFBFBD>
|
|
|
|
|
UPDATE A
|
|
|
|
|
SET A.FCompId = B.FCompId
|
|
|
|
|
FROM TMember AS A,TMemberCard AS B
|
|
|
|
|
WHERE A.FCompId IN(SELECT FCompId FROM #Company)
|
|
|
|
|
AND A.FDeleted = 0
|
|
|
|
|
AND B.FDeleted = 0
|
|
|
|
|
AND A.FMemId = B.FMemId
|
|
|
|
|
|
|
|
|
|
UPDATE A
|
|
|
|
|
SET A.FCompId = B.FCompId
|
|
|
|
|
FROM TMember AS A,TMemberCourse AS B
|
|
|
|
|
WHERE A.FCompId IN(SELECT FCompId FROM #Company)
|
|
|
|
|
AND A.FDeleted = 0
|
|
|
|
|
AND B.FDeleted = 0
|
|
|
|
|
AND A.FMemId = B.FMemId
|
|
|
|
|
|
|
|
|
|
--<EFBFBD><EFBFBD><EFBFBD>µ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵı<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
UPDATE A
|
|
|
|
|
SET A.FMemNO = B.FMemNo
|
|
|
|
|
FROM TCOnsumeBill AS A,TMember AS B
|
|
|
|
|
WHERE A.FMemId = B.FMemId
|
|
|
|
|
AND B.FDeleted = 1
|
|
|
|
|
|
|
|
|
|
--<EFBFBD><EFBFBD><EFBFBD>µ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵı<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
UPDATE A
|
|
|
|
|
SET A.FCardNo = B.FCardNo
|
|
|
|
|
FROM TCOnsumeBill AS A,TMemberCard AS B
|
|
|
|
|
WHERE A.FCardId = B.FCardId
|
|
|
|
|
AND B.FDeleted = 1
|
|
|
|
|
|
|
|
|
|
--<EFBFBD><EFBFBD><EFBFBD>µ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵı<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
UPDATE A
|
|
|
|
|
SET A.FMemNO = B.FMemNo
|
|
|
|
|
FROM TMemberSaleBill AS A,TMember AS B
|
|
|
|
|
WHERE A.FMemId = B.FMemId
|
|
|
|
|
AND B.FDeleted = 1
|
|
|
|
|
|
|
|
|
|
--<EFBFBD><EFBFBD><EFBFBD>µ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵı<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
UPDATE A
|
|
|
|
|
SET A.FPayCardNo = B.FCardNo
|
|
|
|
|
FROM TMemberSaleBill AS A,TMemberCard AS B
|
|
|
|
|
WHERE A.FPayCardId = B.FCardId
|
|
|
|
|
AND B.FDeleted = 1
|
|
|
|
|
|
|
|
|
|
--<EFBFBD><EFBFBD><EFBFBD>µ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵı<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
UPDATE A
|
|
|
|
|
SET A.FCardNo = B.FCardNo
|
|
|
|
|
FROM TMemberSaleCard AS A,TMemberCard AS B
|
|
|
|
|
WHERE A.FCardId = B.FCardId
|
|
|
|
|
AND B.FDeleted = 1
|
|
|
|
|
|
|
|
|
|
--<EFBFBD>û<EFBFBD>
|
|
|
|
|
DELETE TUserAllowCompany WHERE FCompId IN(SELECT FCompId FROM #Company)
|
|
|
|
|
UPDATE TUser SET FNo = FNo + '<EFBFBD><EFBFBD>ɾ',FDeleted = 1 WHERE FId NOT IN(SELECT FUserId FROM TUserAllowCompany)
|
|
|
|
|
AND FNo != 'Admin'
|
|
|
|
|
|
|
|
|
|
--<EFBFBD><EFBFBD>Ŀ
|
|
|
|
|
DELETE TItemSub WHERE FCompId IN(SELECT FCompId FROM #Company)
|
|
|
|
|
DELETE TGoodsSub WHERE FCompId IN(SELECT FCompId FROM #Company)
|
|
|
|
|
DELETE TEmployeeSub WHERE FCompId IN(SELECT FCompId FROM #Company)
|
|
|
|
|
DELETE TMemberCardTypeSub WHERE FCompId IN(SELECT FCompId FROM #Company)
|
|
|
|
|
DELETE TBasicTypeSub WHERE FCompId IN(SELECT FCompId FROM #Company)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UPDATE TUser SET FDeleted = 0,FNo ='Admin' WHERE FId = 1
|
|
|
|
|
|
|
|
|
|
DELETE TUserRole WHERE FUserId NOT IN(SELECT FId FROM TUser WHERE FDeleted = 0)
|
|
|
|
|
|
|
|
|
|
DELETE TRole WHERE FId NOT IN(SELECT FRoleId FROM TUserRole)
|
|
|
|
|
|
|
|
|
|
DELETE TRoleAccess WHERE FRoleId NOT IN(SELECT FRoleId FROM TUserRole)
|
|
|
|
|
|
|
|
|
|
UPDATE TItem SET FNo = FNo + '<EFBFBD><EFBFBD>ɾ',FDeleted = 1
|
|
|
|
|
WHERE FId NOT IN(
|
|
|
|
|
SELECT FItemId FROM TItemSub WHERE FCompId != 1
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TWebAppInfo
|