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

190 lines
9.6 KiB

sp_kill_db ''
SELECT * FROM QingDao_ZhuoYue..TMemberCardType
SELECT * FROM QingDao_ZhuoYueLingXiu..TMemberCardType
SELECT * FROM QingDao_ZhuoYueLingXiu..TUser
SELECT * FROM TUser
UPDATE QingDao_ZhuoYueLingXiu..TUser SET FNo = FNo + '.LX' WHERE FNo = '666'
UPDATE QingDao_ZhuoYueLingXiu..TMemberCardType SET FNo = 'LX' + FNo
SELECT A.FNo,A.FName,B.FName
FROM QingDao_ZhuoYueLingXiu..TEmployee AS A,QingDao_ZhuoYue..TEmployee AS B
WHERE A.FNo = B.FNo
AND A.FId != B.FId
UPDATE QingDao_ZhuoYueLingXiu..TEmployee SET FNo = '009ÒÑɾ2' WHERE FNo = '009ÒÑɾ1'
UPDATE QingDao_ZhuoYueLingXiu..TItem
SET FNoOfPad = FNoOfPad + '.004'
WHERE FNoOfPad IN(
SELECT A.FNoOfPad
FROM QingDao_ZhuoYueLingXiu..TItem AS A,QingDao_ZhuoYue..TItem AS B
WHERE A.FNoOfPad = B.FNo)
SELECT A.FNo,A.FName,B.FName
FROM QingDao_ZhuoYueLingXiu..TGoods AS A,QingDao_ZhuoYue..TGoods AS B
WHERE A.FNo = B.FNo
SELECT A.FNo,A.FName,B.FName
FROM QingDao_ZhuoYueLingXiu..TBasicType AS A,QingDao_ZhuoYue..TBasicType AS B
WHERE A.FNo = B.FNo
AND A.FKey = B.FKey
AND A.FId != B.FId
SELECT * FROM QingDao_ZhuoYueLingXiu..TBasicType WHERE FNo = '1'
UPDATE QingDao_ZhuoYueLingXiu..TBasicType SET FNo = 'LX1' WHERE FId = 5728939706673078715
UPDATE QingDao_ZhuoYueLingXiu..TBasicType SET FNo = 'LX1' WHERE FId = 5493532468581143931
UPDATE QingDao_ZhuoYueLingXiu..TBasicType SET FNo = 'LX2' WHERE FId = 5630474368584084328
SELECT * FROM QingDao_ZhuoYueLingXiu..TCompany
SELECT * FROM QingDao_ZhuoYue..TCompany
update QingDao_ZhuoYueLingXiu..TCompany SET FNo = '004' WHERE FNo = '002'
SELECT * FROM TLoginSession
SELECT * FROM QingDao_ZhuoYueLingXiu..TEmployee WHERE FNo IN(SELECT FNo FROM QingDao_ZhuoYue..TEmployee)
UPDATE QingDao_ZhuoYueLingXiu..TEmployee SET FNo = '666.LX' WHERE FNo = '666'
EXEC PImportTable 'QingDao_ZhuoYueLingXiu..TCompany','QingDao_ZhuoYue..TCompany',' AND FNo = ''004'' '
EXEC PImportTable 'QingDao_ZhuoYueLingXiu..TUser','QingDao_ZhuoYue..TUser',' AND FId >1 '
EXEC PImportTable 'QingDao_ZhuoYueLingXiu..TUserAllowCompany','QingDao_ZhuoYue..TUserAllowCompany',' '
SELECT R.FName,U.FNO
FROM QingDao_ZhuoYueLingXiu..TUser AS U,QingDao_ZhuoYueLingXiu..TRole AS R,
QingDao_ZhuoYueLingXiu..TUserRole AS UR
WHERE UR.FRoleId = R.FId
AND U.FId = UR.FUserId
--Ô±¹¤
EXEC PImportTable 'QingDao_ZhuoYueLingXiu..TEmployee','QingDao_ZhuoYue..TEmployee',' AND FId > 0 AND FDeleted = 0 '
EXEC PImportTable 'QingDao_ZhuoYueLingXiu..TEmployeeSub','QingDao_ZhuoYue..TEmployeeSub',' '
EXEC PImportTable 'QingDao_ZhuoYueLingXiu..TEmployee','QingDao_ZhuoYue..TEmployee',' AND FId > 0 AND FDeleted = 1 '
EXEC PImportTable 'QingDao_ZhuoYueLingXiu..TEmployeeSub','QingDao_ZhuoYue..TEmployeeSub',' '
--씀EXEC PImportTable 'QingDao_ZhuoYueLingXiu..TItem','QingDao_ZhuoYue..TItem',' AND FId > 0 '
EXEC PImportTable 'QingDao_ZhuoYueLingXiu..TItemSub','QingDao_ZhuoYue..TItemSub',' '
--²úÆ·
EXEC PImportTable 'QingDao_ZhuoYueLingXiu..TGoods','QingDao_ZhuoYue..TGoods',' AND FId > 0 '
EXEC PImportTable 'QingDao_ZhuoYueLingXiu..TGoodsSub','QingDao_ZhuoYue..TGoodsSub',' '
--Àà±ð
EXEC PImportTable 'QingDao_ZhuoYueLingXiu..TBasicType','QingDao_ZhuoYue..TBasicType',' AND FId > 1000000 AND FKey != ''CourseType'' '
EXEC PImportTable 'QingDao_ZhuoYueLingXiu..TBasicTypeSub','QingDao_ZhuoYue..TBasicTypeSub',' AND FBasicTypeId IN(SELECT FId FROM TBasicType) '
SELECT FId,FKey,FNo,FName,FParentId,FDescription,FCustom,FOrder,FAllowEdit,FEnabled FROM QingDao_ZhuoYueLingXiu..TBasicType WHERE 1=1 AND FId > 1000000
--ÕÛ¿Û
EXEC PImportTable 'QingDao_ZhuoYueLingXiu..TItemDiscountMaster','QingDao_ZhuoYue..TItemDiscountMaster',' AND FId > 0 '
EXEC PImportTable 'QingDao_ZhuoYueLingXiu..TItemDiscountMid','QingDao_ZhuoYue..TItemDiscountMid',' AND FId > 0 '
EXEC PImportTable 'QingDao_ZhuoYueLingXiu..TItemDiscountDetail','QingDao_ZhuoYue..TItemDiscountDetail',' AND FId > 0 '
--ÕÛ¿Û
EXEC PImportTable 'QingDao_ZhuoYueLingXiu..TGoodsDiscountMaster','QingDao_ZhuoYue..TGoodsDiscountMaster',' AND FId > 0 '
EXEC PImportTable 'QingDao_ZhuoYueLingXiu..TGoodsDiscountDetail','QingDao_ZhuoYue..TGoodsDiscountDetail',' AND FId > 0 '
--Ìá³É
EXEC PImportTable 'QingDao_ZhuoYueLingXiu..TItemBaseComm','QingDao_ZhuoYue..TItemBaseComm',' AND FId > 0 '
EXEC PImportTable 'QingDao_ZhuoYueLingXiu..TGoodsBaseComm','QingDao_ZhuoYue..TGoodsBaseComm',' AND FId > 0 '
EXEC PImportTable 'QingDao_ZhuoYueLingXiu..TItemCommSchemeMaster','QingDao_ZhuoYue..TItemCommSchemeMaster',' AND FId > 0 '
EXEC PImportTable 'QingDao_ZhuoYueLingXiu..TItemCommSchemeSection','QingDao_ZhuoYue..TItemCommSchemeSection',' AND FId > 0 '
EXEC PImportTable 'QingDao_ZhuoYueLingXiu..TItemCommSchemeDetail','QingDao_ZhuoYue..TItemCommSchemeDetail',' AND FId > 0 '
--¿¨Àà±ð
EXEC PImportTable 'QingDao_ZhuoYueLingXiu..TMemberCardType','QingDao_ZhuoYue..TMemberCardType',' AND FId > 6'
EXEC PImportTable 'QingDao_ZhuoYueLingXiu..TMemberCardTypeSub','QingDao_ZhuoYue..TMemberCardTypeSub',' AND FId > 6'
--»áÔ±
EXEC PImportTable 'QingDao_ZhuoYueLingXiu..TMember','QingDao_ZhuoYue..TMember',' AND FMemId > 0'
EXEC PImportTable 'QingDao_ZhuoYueLingXiu..TMemberCard','QingDao_ZhuoYue..TMemberCard',' AND FCardId > 0'
EXEC PImportTable 'QingDao_ZhuoYueLingXiu..TMemberCardAccount','QingDao_ZhuoYue..TMemberCardAccount',' AND FCardId > 0'
EXEC PImportTable 'QingDao_ZhuoYueLingXiu..TMemberCardAcctHist','QingDao_ZhuoYue..TMemberCardAcctHist',' AND FCardId > 0'
EXEC PImportTable 'QingDao_ZhuoYueLingXiu..TMemberTransHist','QingDao_ZhuoYue..TMemberTransHist',' AND FCardId > 0'
EXEC PImportTable 'QingDao_ZhuoYueLingXiu..TMemberTransHistPayment','QingDao_ZhuoYue..TMemberTransHistPayment',' AND FCardId > 0'
EXEC PImportTable 'QingDao_ZhuoYueLingXiu..TMemberPointHist','QingDao_ZhuoYue..TMemberPointHist',' '
EXEC PImportTable 'QingDao_ZhuoYueLingXiu..TMemberCourse','QingDao_ZhuoYue..TMemberCourse',' '
EXEC PImportTable 'QingDao_ZhuoYueLingXiu..TMemberArrear','QingDao_ZhuoYue..TMemberArrear',' '
EXEC PImportTable 'QingDao_ZhuoYueLingXiu..TMemberEmployee','QingDao_ZhuoYue..TMemberEmployee',' '
EXEC PImportTable 'QingDao_ZhuoYueLingXiu..TMemberChangeLog','QingDao_ZhuoYue..TMemberChangeLog',' '
--»áÔ±ÏúÊÛµ¥
EXEC PImportTable 'QingDao_ZhuoYueLingXiu..TMemberSaleBill','QingDao_ZhuoYue..TMemberSaleBill',' '
EXEC PImportTable 'QingDao_ZhuoYueLingXiu..TMemberSaleCard','QingDao_ZhuoYue..TMemberSaleCard',' '
EXEC PImportTable 'QingDao_ZhuoYueLingXiu..TMemberSaleCombo','QingDao_ZhuoYue..TMemberSaleCombo',' '
EXEC PImportTable 'QingDao_ZhuoYueLingXiu..TMemberSaleCourse','QingDao_ZhuoYue..TMemberSaleCourse',' '
EXEC PImportTable 'QingDao_ZhuoYueLingXiu..TMemberSaleCourseGoods','QingDao_ZhuoYue..TMemberSaleCourseGoods',' '
EXEC PImportTable 'QingDao_ZhuoYueLingXiu..TMemberSaleCoursePack','QingDao_ZhuoYue..TMemberSaleCoursePack',' '
EXEC PImportTable 'QingDao_ZhuoYueLingXiu..TMemberSaleDetailPayment','QingDao_ZhuoYue..TMemberSaleDetailPayment',' '
EXEC PImportTable 'QingDao_ZhuoYueLingXiu..TMemberSaleDetailSplit','QingDao_ZhuoYue..TMemberSaleDetailSplit',' '
EXEC PImportTable 'QingDao_ZhuoYueLingXiu..TMemberSaleEmployee','QingDao_ZhuoYue..TMemberSaleEmployee',' '
EXEC PImportTable 'QingDao_ZhuoYueLingXiu..TMemberSaleExchange','QingDao_ZhuoYue..TMemberSaleExchange',' '
EXEC PImportTable 'QingDao_ZhuoYueLingXiu..TMemberSaleExchangeSource','QingDao_ZhuoYue..TMemberSaleExchangeSource',' '
EXEC PImportTable 'QingDao_ZhuoYueLingXiu..TMemberSaleInfo','QingDao_ZhuoYue..TMemberSaleInfo',' '
EXEC PImportTable 'QingDao_ZhuoYueLingXiu..TMemberSaleFreeItem','QingDao_ZhuoYue..TMemberSaleFreeItem',' '
EXEC PImportTable 'QingDao_ZhuoYueLingXiu..TMemberSaleRepay','QingDao_ZhuoYue..TMemberSaleRepay',' '
EXEC PImportTable 'QingDao_ZhuoYueLingXiu..TMemberSalePayment','QingDao_ZhuoYue..TMemberSalePayment',' '
--Ïû·Ñ
EXEC PImportTable 'QingDao_ZhuoYueLingXiu..TConsumeBill','QingDao_ZhuoYue..TConsumeBill',' '
EXEC PImportTable 'QingDao_ZhuoYueLingXiu..TConsumeGoods','QingDao_ZhuoYue..TConsumeGoods',' '
EXEC PImportTable 'QingDao_ZhuoYueLingXiu..TConsumeGoodsEmployee','QingDao_ZhuoYue..TConsumeGoodsEmployee',' '
EXEC PImportTable 'QingDao_ZhuoYueLingXiu..TConsumeGoodsPayment','QingDao_ZhuoYue..TConsumeGoodsPayment',' '
EXEC PImportTable 'QingDao_ZhuoYueLingXiu..TConsumeItem','QingDao_ZhuoYue..TConsumeItem',' '
EXEC PImportTable 'QingDao_ZhuoYueLingXiu..TConsumeItemCostGoods','QingDao_ZhuoYue..TConsumeItemCostGoods',' '
EXEC PImportTable 'QingDao_ZhuoYueLingXiu..TConsumeItemEmployee','QingDao_ZhuoYue..TConsumeItemEmployee',' '
EXEC PImportTable 'QingDao_ZhuoYueLingXiu..TConsumeItemPayment','QingDao_ZhuoYue..TConsumeItemPayment',' '
EXEC PImportTable 'QingDao_ZhuoYueLingXiu..TConsumeReturnVisit','QingDao_ZhuoYue..TConsumeReturnVisit',' '
EXEC PImportTable 'QingDao_ZhuoYueLingXiu..TConsumeReturnVisitLog','QingDao_ZhuoYue..TConsumeReturnVisitLog',' '
SELECT * FROM sysobjects where name like 'TConsume%'
SELECT * FROM QingDao_ZhuoYue..TMemberCardAcctHist
ALTER TABLE TMemberCardAccount DROP COLUMN FOldExpiredDate
SELECT * FROM QingDao_ZhuoYueLingXiu..TMemberCard
WHERE FCardNo IN(SELECT FCardNo FROM QingDao_ZhuoYue..TMemberCard)
DECLARE @Columns VARCHAR(8000)
-- SELECT @Source = 'db108.ZiBo_YanYi.dbo.TMember'
-- SELECT @Target = 'TMember'
SELECT @Columns = ''
SELECT @Columns = @Columns + name + ',' FROM syscolumns WHERE id = object_id('QingDao_ZhuoYue..TMemberCardAcctHist')
AND colstat != 4
AND xtype != 189
print @Columns
IF @@ROWCOUNT = 0
BEGIN
SELECT @Columns = ''
SELECT @Columns = @Columns + name + ',' FROM syscolumns WHERE id = object_id('QingDao_ZhuoYue..TMemberCardAcctHist')
AND colstat != 4
AND xtype != 189
END