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].[供应商资料表]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[供应商资料表]
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[商品库存表]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[商品库存表]
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[商品资料表]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[商品资料表]
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[客户资料表]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[客户资料表]
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[用户信息表]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[用户信息表]
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[盘点明细表]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[盘点明细表]
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[采购单明细表]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[采购单明细表]
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[采购单表]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[采购单表]
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[销售单明细表]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[销售单明细表]
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[销售单表]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[销售单表]
GO
CREATE TABLE [dbo].[供应商资料表] (
[supplierID] [char] (4) COLLATE Chinese_PRC_CI_AS NOT NULL ,
[supplierName] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
[address] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
[telphone] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
[fax] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
[credibility] [char] (2) COLLATE Chinese_PRC_CI_AS NULL ,
[commoditySupply] [text] COLLATE Chinese_PRC_CI_AS NULL ,
[introduction] [text] COLLATE Chinese_PRC_CI_AS NULL
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
CREATE TABLE [dbo].[商品库存表] (
[commodityID] [char] (6) COLLATE Chinese_PRC_CI_AS NOT NULL ,
[state] [char] (8) COLLATE Chinese_PRC_CI_AS NOT NULL ,
[costPrice] [float] NOT NULL ,
[salePrice] [float] NOT NULL ,
[inventoryNumber] [float] NOT NULL ,
[inventoryTAmount] [float]�