if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[CRM_DOCUMENT]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[CRM_DOCUMENT]
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[CRM_DOCUMENT_TYPE]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[CRM_DOCUMENT_TYPE]
GO
CREATE TABLE [dbo].[CRM_DOCUMENT] (
[id] [numeric](18, 0) IDENTITY (1, 1) NOT NULL ,
[DocTitle] [char] (100) NULL ,--文档标题
[DocDescript] [char] (1000) NULL ,--文档描述
[DocPath] [char] (500) NULL ,--文档路径
[DocType] [char] (10) NULL ,--文档类型
[Reader] [nvarchar] (3000) NULL --可查阅读者
) ON [PRIMARY]
GO
CREATE TABLE [dbo].[CRM_DOCUMENT_TYPE] (
[ID] [numeric](18, 0) IDENTITY (1, 1) NOT NULL ,
[DocTypeID] [char] (10) NULL ,--文档类型编码
[DocTypeName] [char] (100) NULL --文档类型
[depth] [int] NULL ,--深度
[ParentDocTypeID] [char] (10) --父文档类型
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[CRM_DOCUMENT] WITH NOCHECK ADD
CONSTRAINT [PK_CRM_DOCUMENT] PRIMARY KEY CLUSTERED
(
[id]
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[CRM_DOCUMENT_TYPE] WITH NOCHECK ADD
CONSTRAINT [PK_CRM_DOCUMENT_TYPE] PRIMARY KEY CLUSTERED
(
[ID]
) ON [PRIMARY]
GO