use qingdao_guizu UPDATE TMemberCardType SET FNo = 'A' + FNo WHERE FId > 10 UPDATE TMember SET FMemNo = 'A' + FMemNo UPDATE TMemberCard SET FCardNo = 'A' + FCardNo UPDATE TConsumeBill SET FCardNo = 'A' + FCardNo UPDATE TConsumeBill SET FMemNo = 'A' + FMemNo UPDATE TMemberSaleBill SET FMemNo = 'A' + FMemNo UPDATE TMemberSaleBill SET FPayCardNo = 'A' + FPayCardNo UPDATE TMemberSaleCard SET FCardNo = 'A' + FCardNo SELECT * FROM db108.QingDao_JinDian.dbo.TMemberCardType SELECT * FROM TMemberCard WHERE FCardNo IN( SELECT FCardNo FROM db108.QingDao_JinDian.dbo.TMemberCard ) EXEC PCopyTable 'TMemberCardType','db108.QingDao_JinDian.dbo.TMemberCardType',' AND FId > 10' EXEC PCopyTable 'TMember','db108.QingDao_JinDian.dbo.TMember',' AND FMemId > 0 ' EXEC PCopyTable 'TMemberCard','db108.QingDao_JinDian.dbo.TMemberCard',' AND FCardId > 0 ' EXEC PCopyTable 'TMemberCardAccount','db108.QingDao_JinDian.dbo.TMemberCardAccount',' AND FCardId > 0 ' EXEC PCopyTable 'TMemberCardAcctHist','db108.QingDao_JinDian.dbo.TMemberCardAcctHist',' AND FCardId > 0 ' EXEC PCopyTable 'TMemberEmployee','db108.QingDao_JinDian.dbo.TMemberEmployee',' ' EXEC PCopyTable 'TMemberPhoto','db108.QingDao_JinDian.dbo.TMemberPhoto',' ' EXEC PCopyTable 'TMemberPointHist','db108.QingDao_JinDian.dbo.TMemberPointHist',' ' EXEC PCopyTable 'TMemberTransHist','db108.QingDao_JinDian.dbo.TMemberTransHist',' ' EXEC PCopyTable 'TMemberTransHistPayment','db108.QingDao_JinDian.dbo.TMemberTransHistPayment',' ' EXEC PCopyTable 'TMemberOldTransHist','db108.QingDao_JinDian.dbo.TMemberOldTransHist',' ' EXEC PCopyTable 'TMemberCardOldAcctHist','db108.QingDao_JinDian.dbo.TMemberCardOldAcctHist',' AND FCardId > 0 ' EXEC PCopyTable 'TMemberArrear','db108.QingDao_JinDian.dbo.TMemberArrear',' ' EXEC PCopyTable 'TMemberArrearEmployee','db108.QingDao_JinDian.dbo.TMemberArrearEmployee',' ' SELECT * FROM TCompany UPDATE TMember SET FCompId = 3472331387795668992 where FCompId = 1 AND FMemId IN(SELECT FMemId FROM db108.QingDao_JinDian.dbo.TMember) AND FMemId > 0 UPDATE TMemberCard SET FCompId = 3472331387795668992 where FCompId = 1 AND FMemId IN(SELECT FMemId FROM db108.QingDao_JinDian.dbo.TMemberCard) AND FMemId > 0 UPDATE TMemberCardAcctHist SET FCompId = 3472331387795668992 where FCompId = 1 AND FMemId IN(SELECT FMemId FROM db108.QingDao_JinDian.dbo.TMember) AND FMemId > 0 UPDATE TMemberTransHist SET FCompId = 3472331387795668992 where FCompId = 1 AND FMemId IN(SELECT FMemId FROM db108.QingDao_JinDian.dbo.TMember) AND FMemId > 0 UPDATE TMemberArrear SET FCompId = 3472331387795668992 where FCompId = 1 AND FMemId IN(SELECT FMemId FROM db108.QingDao_JinDian.dbo.TMember) AND FMemId > 0 INSERT INTO TMemberCardTypeSub(FId,FCompId,FCardTypeId,FAllowSale,FAllowRchg,FEnabled) SELECT dbo.FNNewId(),C.FId,I.FId,FAllowSale,FAllowRchg,FEnabled FROM TMemberCardType AS I,TCompany AS C WHERE I.FId > 1 AND C.FId = 3472331387795668992 AND NOT EXISTS(SELECT TOP 1 1 FROM TMemberCardTypeSub AS B WHERE B.FCompId = C.FId AND B.FCardTypeId = I.FId) select * from TMember WHERE FMemNo LIKE '%A%'