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

124 lines
4.3 KiB

1 year ago
use qingdao_guchuan
SELECT * FROM TCompany
select* from sys.sysservers
SELECT * FROM qd77.qingdao_malin.dbo.TMemberCard
WHERE FCardNo IN(SELECT FCardNo FROM TMemberCard)
SELECT * INTO _CardType FROM TMemberCardType WHERE 1=0
EXEC PCopyTable 'TMemberCardType','_CardType',' AND FId > 9'
UPDATE _CardType SET FName = FName + '[<EFBFBD><EFBFBD><EFBFBD><EFBFBD>]'
EXEC PCopyTable '_CardType','qd77.qingdao_malin.dbo.TMemberCardType',
' AND FId IN(SELECT FTypeId FROM qd77.qingdao_malin.dbo.TMemberCard WHERE FCompId = 3472331387795668992)'
UPDATE _CardType SET FNo = 'M' + FNo
SELECT * FROM TMemberCardType
SELECT * INTO _Item FROM TItem WHERE 1=0
SELECT * INTO _Course FROM TCourse WHERE 1=0
SELECT * INTO _Pack FROM TCoursePack WHERE 1=0
EXEC PCopyTable '_Item','qd77.qingdao_malin.dbo.TItem',
' AND FId IN(SELECT FItemId FROM qd77.qingdao_malin.dbo.TMemberCourse WHERE FCompId = 3472331387795668992)'
EXEC PCopyTable '_Course','qd77.qingdao_malin.dbo.TCourse',
' AND FId IN(SELECT FCourseId FROM qd77.qingdao_malin.dbo.TMemberCourse WHERE FCompId = 3472331387795668992)'
EXEC PCopyTable '_Pack','qd77.qingdao_malin.dbo.TCoursePack',
' AND FId IN(SELECT FPackId FROM qd77.qingdao_malin.dbo.TMemberCoursePack WHERE FCompId = 3472331387795668992)'
SELECT * FROM _Pack
UPDATE _ITEM SET FNO = 'M' + FNo
UPDATE _Course SET FNO = 'M' + FNo
EXEC PCopyTable 'TCoursePack','_Pack',''
EXEC PCopyTable 'TItem','_Item',''
EXEC PCopyTable 'TCourse','_Course','AND FId > 0 '
SELECT FCourseId FROM qd77.qingdao_malin.dbo.TMemberCourse
WHERE FCompId = 3472331387795668992
AND FMemPackId > 0
SELECT * FROM _Course
DELETE
SELECT * INTO _Member FROM TMember WHERE 1=0
SELECT * INTO _MemberCard FROM TMemberCard WHERE 1=0
SELECT * INTO _MemberCoursePack FROM TMemberCoursePack WHERE 1=0
SELECT * INTO _MemberCourse FROM TMemberCourse WHERE 1=0
EXEC PCopyTable '_Member','qd77.qingdao_malin.dbo.TMember',
' AND FMemId IN(SELECT FMemId FROM qd77.qingdao_malin.dbo.TMemberCard WHERE FCompId = 3472331387795668992)
OR FMemId IN(SELECT FMemId FROM qd77.qingdao_malin.dbo.TMemberCourse WHERE FCompId = 3472331387795668992)'
EXEC PCopyTable '_MemberCard','qd77.qingdao_malin.dbo.TMemberCard',
' AND FCompId = 3472331387795668992 '
EXEC PCopyTable '_MemberCoursePack','qd77.qingdao_malin.dbo.TMemberCoursePack',
' AND FCompId = 3472331387795668992 '
EXEC PCopyTable '_MemberCourse','qd77.qingdao_malin.dbo.TMemberCourse',
' AND FCompId = 3472331387795668992 '
EXEC PCopyTable 'TMemberCardAccount','qd77.qingdao_malin.dbo.TMemberCardAccount',
' AND FCardId IN(SELECT FCardId FROM _MemberCard) '
EXEC PCopyTable 'TMemberCardAcctHist','qd77.qingdao_malin.dbo.TMemberCardAcctHist',
' AND FCardId IN(SELECT FCardId FROM _MemberCard) '
EXEC PCopyTable 'TMemberCardOldAcctHist','qd77.qingdao_malin.dbo.TMemberCardOldAcctHist',
' AND FCardId IN(SELECT FCardId FROM _MemberCard) '
EXEC PCopyTable 'TMemberTransHist','qd77.qingdao_malin.dbo.TMemberTransHist',
' AND FMemId IN(SELECT FMemId FROM _Member) '
EXEC PCopyTable 'TMemberOldTransHist','qd77.qingdao_malin.dbo.TMemberOldTransHist',
' AND FMemId IN(SELECT FMemId FROM _Member) '
EXEC PCopyTable 'TMemberArrear','qd77.qingdao_malin.dbo.TMemberArrear',
' AND FMemId IN(SELECT FMemId FROM _Member) '
EXEC PCopyTable 'TMemberArrearEmployee','qd77.qingdao_malin.dbo.TMemberArrearEmployee',
' AND FMemId IN(SELECT FMemId FROM _Member) '
EXEC PCopyTable 'TMemberRepay','qd77.qingdao_malin.dbo.TMemberRepay',
' AND FMemId IN(SELECT FMemId FROM _Member) '
EXEC PCopyTable 'TMember','_Member',''
UPDATE _Member SET FMemo = FMemo + '<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֡<EFBFBD>'
EXEC PCopyTable 'TMemberCard','_MemberCard',''
UPDATE _MemberCard SET FMemo = FMemo + '<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֡<EFBFBD>'
EXEC PCopyTable 'TMemberCoursePack','_MemberCoursePack',''
UPDATE _MemberCoursePack SET FMemo = FMemo + '<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֡<EFBFBD>'
EXEC PCopyTable 'TMemberCourse','_MemberCourse',''
UPDATE _MemberCourse SET FMemo = FMemo + '<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֡<EFBFBD>'
UPDATE TMemberCard SET FCompId = 1 WHERE FCompId= 3472331387795668992
UPDATE TMemberCourse SET FCompId = 1 WHERE FCompId= 3472331387795668992
UPDATE TMemberCoursePack SET FCompId = 1 WHERE FCompId= 3472331387795668992
UPDATE TMember SET FCompId = 1 WHERE FCompId= 3472331387795668992
EXEC PCopyTable 'TMember','qd77.qingdao_malin.dbo.TMemberCardType',
' AND FId IN(SELECT FTypeId FROM qd77.qingdao_malin.dbo.TMemberCard WHERE FCompId = 3472331387795668992)'