📄 进销存管理.sql
字号:
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 销售合同_客户编号_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
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
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
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
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
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -