根据上面的数据库语句,我需要将管家婆普及版tr的数据库导出到excel表。然后倒入tr管家婆辉煌366++数据库。具体操作如下:
excel数据表导入tryl数据库有37个表出现错误分别是:大概有数据的有:
areatype atypecw btype goodsstocks inigoodsstocks ptype t_gbl_actionlist t_gbl_datatypelist t_gbl_fieldtypelist t_gbl_functionlist t_gbl_messagelist t_gbl_rightkind t_gbl_stringlist v_atypename v_atypewidz v_btypearap v_btypename v_btypeotherarap v_ptypecalc v_ptypename v_ptypename2 vchtype view_zz_vchbalance zerotype
倒表语句实用存下:对照excel导出的所有表项。
use tr
set IDENTITY_INSERT areatype ON
insert into areatype(Leveal,SonNum,SonCount,UserCode,Name,FullName,Comment,Deleted,Rec,ParRec,namepy) select Leveal,SonNum,SonCount,UserCode,Name,FullName,Comment,Deleted,Rec,ParRec,namepy from 天润新.dbo.areatype
set IDENTITY_INSERT areatype off
ptype_index 一个主键 删掉索引后导入数据,然后在工具——管理索引重建一个索引
use tr
set IDENTITY_INSERT ptype ON
insert into ptype(typeId,ParId,leveal,sonnum,soncount,CanModify,UserCode,FullName,Name,Standard,Type,Area,Unit1,Unit2,UnitRate1,UnitRate2,preprice1,preprice2,preprice3,preprice4,UsefulLifeMonth,UsefulLifeDay,Comment,recPrice,deleted,costmode,Namepy,warnup,warndown,Rec,ParRec,barcode)
select typeId,ParId,leveal,sonnum,soncount,CanModify,UserCode,FullName,Name,Standard,Type,Area,Unit1,Unit2,UnitRate1,UnitRate2,preprice1,preprice2,preprice3,preprice4,UsefulLifeMonth,UsefulLifeDay,Comment,recPrice,deleted,costmode,Namepy,warnup,warndown,Rec,ParRec,barcode from 天润新.dbo.ptype
set IDENTITY_INSERT ptype off
goodsstockindex 2个主键
use trx
insert into goodsstocks(PtypeId,KtypeId,JobNumber,OutFactoryDate,Qty,Price,Total,GoodsOrder)
select PtypeId,KtypeId,JobNumber,OutFactoryDate,Qty,Price,Total,GoodsOrder from 天润新.dbo.goodsstocks
use trx
insert into inigoodsstocks(PtypeId,KtypeId,JobNumber,OutFactoryDate,Qty,Price,Total,GoodsOrder)
select PtypeId,KtypeId,JobNumber,OutFactoryDate,Qty,Price,Total,GoodsOrder from 天润新.dbo.inigoodsstocks
btypeidx 1个主键唯一索引
use trx
set IDENTITY_INSERT btype ON
insert into btype(typeId,parid,leveal,soncount,sonnum,UserCode,FullName,Name,Area,TelAndAddress,PostCode,Person,TaxNumber,BankAndAcount,Comment,ARTotal,APTotal,ARTotal00,APTotal00,deleted,Namepy,Rec,ParRec,AreaTypeID,fax)
select typeId,parid,leveal,soncount,sonnum,UserCode,FullName,Name,Area,TelAndAddress,PostCode,Person,TaxNumber,BankAndAcount,Comment,ARTotal,APTotal,ARTotal00,APTotal00,deleted,Namepy,Rec,
ParRec,AreaTypeID,fax from 天润新.dbo.btype
set IDENTITY_INSERT btype off
ptype有唯一主键索引无法导入,删除索引ptype_index后导入,然后重建索引。
下面的SQL语句对students表在sid上添加PRIMARY KEY索引。
ALTER TABLE ptype ADD PRIMARY KEY (typeId)