if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[采购订单_供货商_fk]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[采购订单] DROP CONSTRAINT 采购订单_供货商_fk
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[采购订单历史_供货商_fk]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[采购订单历史] DROP CONSTRAINT 采购订单历史_供货商_fk
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[采购合同_供货商_fk]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[采购合同] DROP CONSTRAINT 采购合同_供货商_fk
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[进货单_供货商_fk]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[进货单] DROP CONSTRAINT 进货单_供货商_fk
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[进货单历史_供货商_fk]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[进货单历史] DROP CONSTRAINT 进货单历史_供货商_fk
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[应付款_供货商_fk]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[应付款] DROP CONSTRAINT 应付款_供货商_fk
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[预付款_供货商_fk]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[预付款] DROP CONSTRAINT 预付款_供货商_fk
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[预收款_供货商_fk]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[预收款] DROP CONSTRAINT 预收款_供货商_fk
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[报损报溢_货号_fk]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[报损报溢] DROP CONSTRAINT 报损报溢_货号_fk
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[报损报溢历史_货号_fk]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[报损报溢历史] DROP CONSTRAINT 报损报溢历史_货号_fk
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[采购订单明细_货号_fk]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[采购订单明细] DROP CONSTRAINT 采购订单明细_货号_fk
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[采购订单明细历史_货号_fk]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[采购订单明细历史] DROP CONSTRAINT 采购订单明细历史_货号_fk
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[采购合同_货号_fk]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[采购合同] DROP CONSTRAINT 采购合同_货号_fk
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[调拨单_货号_fk]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[调拨单] DROP CONSTRAINT 调拨单_货号_fk
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[调拨单历史_货号_fk]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[调拨单历史] DROP CONSTRAINT 调拨单历史_货号_fk
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[调货申请_货号_fk]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[调货申请] DROP CONSTRAINT 调货申请_货号_fk
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[进货单明细_货号_fk]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[进货单明细] DROP CONSTRAINT 进货单明细_货号_fk
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[进货单明细历史_货号_fk]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[进货单明细历史] DROP CONSTRAINT 进货单明细历史_货号_fk
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[进销存汇总表_货号_fk]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[进销存汇总表] DROP CONSTRAINT 进销存汇总表_货号_fk
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[库存库_货号_fk]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[库存库] DROP CONSTRAINT 库存库_货号_fk
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[盘点单_货号_fk]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[盘点单] DROP CONSTRAINT 盘点单_货号_fk
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[盘点单历史_货号_fk]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[盘点单历史] DROP CONSTRAINT 盘点单历史_货号_fk
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[上下限对照表_货号_fk]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[上下限对照表] DROP CONSTRAINT 上下限对照表_货号_fk
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[销售单明细_货号_fk]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[销售单明细] DROP CONSTRAINT 销售单明细_货号_fk
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[销售单明细历史_货号_fk]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[销售单明细历史] DROP CONSTRAINT 销售单明细历史_货号_fk
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[销售订单明细_货号_fk]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[销售订单明细] DROP CONSTRAINT 销售订单明细_货号_fk
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[销售订单明细历史_货号_fk]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[销售订单明细历史] DROP CONSTRAINT 销售订单明细历史_货号_fk
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[销售合同_货号_fk]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[销售合同] DROP CONSTRAINT 销售合同_货号_fk
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[销售日报_货号_fk]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[销售日报] DROP CONSTRAINT 销售日报_货号_fk
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[销退货单_货号_fk]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[销退货单] DROP CONSTRAINT 销退货单_货号_fk
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[销退货单历史_货号_fk]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[销退货单历史] DROP CONSTRAINT 销退货单历史_货号_fk
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[应付款_货号_fk]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[应付款] DROP CONSTRAINT 应付款_货号_fk
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[应收款_货号_fk]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[应收款] DROP CONSTRAINT 应收款_货号_fk
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[销售单_客户编号_fk]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[销售单] DROP CONSTRAINT 销售单_客户编号_fk
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[销售单历史_客户编号_fk]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[销售单历史] DROP CONSTRAINT 销售单历史_客户编号_fk
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[销售订单_客户编号_fk]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[销售订单] DROP CONSTRAINT 销售订单_客户编号_fk
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[销售订单历史_客户编号_fk]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[销售订单历史] DROP CONSTRAINT 销售订单历史_客户编号_fk
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[销售合同_客户编号_fk]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[销售合同] DROP CONSTRAINT 销售合同_客