解决方案: |
按以下步骤修改: 1、执行以下脚本,删除和仓库表关联的外键及仓库记录 alter table IA_Subsidiary drop constraint FK__IA_Subsid__cWhCo__7B3C2211 go alter table CurrentStock drop constraint FK__CurrentSt__cWhCo__776B912D go alter table MainBatch drop constraint FK__MainBatch__cWhCo__7F0CB2F5 go alter table DispatchLists drop constraint FK__DispatchL__cWhCo__785FB566 go select * into warehouse_bak from warehouse go delete from warehouse 2、根据表warehouse_bak的记录在软件中手工输入仓库记录 3、执行以下语句重建与仓库表关联的外键 alter table IA_Subsidiary add constraint FK__IA_Subsid__cWhCo__7B3C2211 foreign key (cwhcode) references warehouse(cwhcode) go alter table CurrentStock add constraint FK__CurrentSt__cWhCo__776B912D foreign key (cwhcode) references warehouse(cwhcode) go alter table MainBatch add constraint FK__MainBatch__cWhCo__7F0CB2F5 foreign key (cwhcode) references warehouse(cwhcode) go alter table DispatchLists add constraint FK__DispatchL__cWhCo__785FB566 foreign key (cwhcode) references warehouse(cwhcode) go 4、删除仓库备份表 drop table warehouse_bak |