if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[mail_b]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[mail_b]


if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[mail_fj]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[mail_fj]


if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[mail_h]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[mail_h]

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[oa_news]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[oa_news]


if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[oa_news_fj]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[oa_news_fj]


if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[oa_news_pn]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[oa_news_pn]

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[oa_flow_file]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[oa_flow_file]

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[oa_xfwj]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[oa_xfwj]


CREATE TABLE [oa_flow_file] (
	[fileid] [char] (32) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[templateid] [char] (20) COLLATE Chinese_PRC_CI_AS NULL ,
	[flowdirid] [char] (20) COLLATE Chinese_PRC_CI_AS NULL ,
	[wj_name] [nvarchar] (100) COLLATE Chinese_PRC_CI_AS NULL ,
	[wj_size] [int] NULL ,
	[userid] [char] (20) COLLATE Chinese_PRC_CI_AS NULL ,
	[deptid] [char] (20) COLLATE Chinese_PRC_CI_AS NULL ,
	[corpid] [char] (20) COLLATE Chinese_PRC_CI_AS NULL ,
	[oprflag] [smallint] NULL ,
	[wj_date] [datetime] NULL ,
	[curr_spr] [char] (20) COLLATE Chinese_PRC_CI_AS NULL ,
	[curr_date] [datetime] NULL ,
	[print_num] [int] NULL ,
	[sourceid] [char] (20) COLLATE Chinese_PRC_CI_AS NULL ,
	[pf_spr] [char] (20) COLLATE Chinese_PRC_CI_AS NULL ,
	[pf_js] [smallint] NULL ,
	[sj_date] [datetime] NULL ,
	[sj_flag] [smallint] NULL ,
	[sj_ry] [char] (20) COLLATE Chinese_PRC_CI_AS NULL ,
	[sj_yj] [nvarchar] (300) COLLATE Chinese_PRC_CI_AS NULL ,
	[wjhjid] [char] (20) COLLATE Chinese_PRC_CI_AS NULL ,
	[wj_wh] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[wjmjid] [char] (20) COLLATE Chinese_PRC_CI_AS NULL ,
	[wjtypeid] [char] (20) COLLATE Chinese_PRC_CI_AS NULL ,
	[wj_key] [nvarchar] (100) COLLATE Chinese_PRC_CI_AS NULL ,
	[wj_fwdw] [nvarchar] (60) COLLATE Chinese_PRC_CI_AS NULL ,
	[wj_fwbm] [nvarchar] (60) COLLATE Chinese_PRC_CI_AS NULL ,
	[wj_ngr] [char] (20) COLLATE Chinese_PRC_CI_AS NULL ,
	[wj_qfr] [char] (20) COLLATE Chinese_PRC_CI_AS NULL ,
	[wj_shdate] [datetime] NULL ,
	[wj_bjsx] [datetime] NULL ,
	[wj_dyfs] [smallint] NULL ,
	[wj_sourcetype] [smallint] NULL ,
	[wj_gdnote] [nvarchar] (100) COLLATE Chinese_PRC_CI_AS NULL ,
	[wj_gdr] [char] (20) COLLATE Chinese_PRC_CI_AS NULL ,
	[wj_gdrid] [char] (20) COLLATE Chinese_PRC_CI_AS NULL ,
	[wj_gddate] [datetime] NULL ,
	[wj_swbh] [char] (20) COLLATE Chinese_PRC_CI_AS NULL ,
	[swlbid] [char] (20) COLLATE Chinese_PRC_CI_AS NULL ,
	[wj_gdajh] [char] (30) COLLATE Chinese_PRC_CI_AS NULL ,
	[wj_lfdw] [nvarchar] (200) COLLATE Chinese_PRC_CI_AS NULL ,
	[wj_zsdw] [nvarchar] (200) COLLATE Chinese_PRC_CI_AS NULL ,
	[wj_csdw] [nvarchar] (200) COLLATE Chinese_PRC_CI_AS NULL ,
	[wj_fsdw] [nvarchar] (200) COLLATE Chinese_PRC_CI_AS NULL ,
	[wj_bz] [nvarchar] (200) COLLATE Chinese_PRC_CI_AS NULL ,
	[wj_fwh] [char] (30) COLLATE Chinese_PRC_CI_AS NULL ,
	[file_path] [varchar] (200) COLLATE Chinese_PRC_CI_AS NULL ,
	[file_key] [char] (40) COLLATE Chinese_PRC_CI_AS NULL ,
	[wj_oldflag] [smallint] NULL ,
	[wj_bjdate] [datetime] NULL ,
	[wj_useddays] [smallint] NULL ,
	[wj_dbflag] [smallint] NULL ,
	[ts] [datetime] NULL ,
	CONSTRAINT [PK_oa_flow_file] PRIMARY KEY  CLUSTERED 
	(
		[fileid]
	)  ON [PRIMARY] 
) ON [PRIMARY]




CREATE TABLE [oa_xfwj] (
	[xfwjid] [char] (20) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[wjtypeid] [char] (20) COLLATE Chinese_PRC_CI_AS NULL ,
	[wjhjid] [char] (20) COLLATE Chinese_PRC_CI_AS NULL ,
	[wjmjid] [char] (20) COLLATE Chinese_PRC_CI_AS NULL ,
	[wj_name] [nvarchar] (100) COLLATE Chinese_PRC_CI_AS NULL ,
	[wj_wh] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[wj_key] [nvarchar] (100) COLLATE Chinese_PRC_CI_AS NULL ,
	[wj_fwdw] [nvarchar] (100) COLLATE Chinese_PRC_CI_AS NULL ,
	[wj_fwbm] [nvarchar] (100) COLLATE Chinese_PRC_CI_AS NULL ,
	[wj_ngr] [char] (30) COLLATE Chinese_PRC_CI_AS NULL ,
	[wj_qfr] [char] (30) COLLATE Chinese_PRC_CI_AS NULL ,
	[wj_sourcetype] [smallint] NULL ,
	[wj_sourceid] [char] (20) COLLATE Chinese_PRC_CI_AS NULL ,
	[oprflag] [smallint] NULL ,
	[wj_gddate] [datetime] NULL ,
	[wj_gdrid] [char] (20) COLLATE Chinese_PRC_CI_AS NULL ,
	[wj_gdr] [char] (20) COLLATE Chinese_PRC_CI_AS NULL ,
	[wj_date] [datetime] NULL ,
	[userid] [char] (20) COLLATE Chinese_PRC_CI_AS NULL ,
	[deptid] [char] (20) COLLATE Chinese_PRC_CI_AS NULL ,
	[wj_zfbz] [smallint] NULL ,
	[wj_zfzs] [smallint] NULL ,
	[ts] [datetime] NULL ,
	[fc] [smallint] NULL ,
	[wj_xwlb] [smallint] NULL ,
	[fwdeptid] [char] (20) COLLATE Chinese_PRC_CI_AS NULL ,
	[wj_gdajh] [char] (30) COLLATE Chinese_PRC_CI_AS NULL ,
	[wj_gdnote] [nvarchar] (100) COLLATE Chinese_PRC_CI_AS NULL ,
	[wj_lfdw] [nvarchar] (200) COLLATE Chinese_PRC_CI_AS NULL ,
	[wj_zsdw] [nvarchar] (200) COLLATE Chinese_PRC_CI_AS NULL ,
	[wj_csdw] [nvarchar] (200) COLLATE Chinese_PRC_CI_AS NULL ,
	[wj_fsdw] [nvarchar] (200) COLLATE Chinese_PRC_CI_AS NULL ,
	[wj_bz] [nvarchar] (30) COLLATE Chinese_PRC_CI_AS NULL ,
	[wj_oldflag] [smallint] NULL ,
	[hzflag] [smallint] NULL ,
	CONSTRAINT [PK_oa_xfwj] PRIMARY KEY  CLUSTERED 
	(
		[xfwjid]
	)  ON [PRIMARY] 
) ON [PRIMARY]



CREATE TABLE [mail_b] (
	[pk_mail] [char] (20) COLLATE Chinese_PRC_CI_AS NULL ,
	[pk_mailb] [char] (20) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[mail_getopr] [char] (40) COLLATE Chinese_PRC_CI_AS NULL ,
	[mail_read] [smallint] NULL ,
	[mail_dele] [smallint] NULL ,
	[mail_readdate] [datetime] NULL ,
	CONSTRAINT [PK_mail_b] PRIMARY KEY  CLUSTERED 
	(
		[pk_mailb]
	)  ON [PRIMARY] 
) ON [PRIMARY]



CREATE TABLE [mail_fj] (
	[pk_mail] [char] (20) COLLATE Chinese_PRC_CI_AS NULL ,
	[pk_fj] [char] (30) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[fj_type] [char] (10) COLLATE Chinese_PRC_CI_AS NULL ,
	[fj_name] [nvarchar] (100) COLLATE Chinese_PRC_CI_AS NULL ,
	[fj_path] [nvarchar] (200) COLLATE Chinese_PRC_CI_AS NULL ,
	[fj_size] [int] NULL ,
	[nrow] [smallint] NULL ,
	[pwd] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[fj_sourceid] [char] (20) COLLATE Chinese_PRC_CI_AS NULL ,
	CONSTRAINT [PK_mail_fj] PRIMARY KEY  CLUSTERED 
	(
		[pk_fj]
	)  ON [PRIMARY] 
) ON [PRIMARY]



CREATE TABLE [mail_h] (
	[pk_mail] [char] (20) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[mail_head] [char] (400) COLLATE Chinese_PRC_CI_AS NULL ,
	[mail_note] [text] COLLATE Chinese_PRC_CI_AS NULL ,
	[mail_sendopr] [char] (20) COLLATE Chinese_PRC_CI_AS NULL ,
	[mail_date] [datetime] NULL ,
	[mail_ip] [char] (20) COLLATE Chinese_PRC_CI_AS NULL ,
	[mail_dele] [smallint] NULL ,
	[mail_size] [int] NULL ,
	CONSTRAINT [PK_mail_h] PRIMARY KEY  CLUSTERED 
	(
		[pk_mail]
	)  ON [PRIMARY] 
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]



CREATE TABLE [oa_news] (
	[newsid] [char] (20) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[news_date] [datetime] NULL ,
	[news_head] [nvarchar] (100) COLLATE Chinese_PRC_CI_AS NULL ,
	[news_text] [text] COLLATE Chinese_PRC_CI_AS NULL ,
	[news_ip] [char] (20) COLLATE Chinese_PRC_CI_AS NULL ,
	[userid] [char] (20) COLLATE Chinese_PRC_CI_AS NULL ,
	[deptid] [char] (20) COLLATE Chinese_PRC_CI_AS NULL ,
	[corpid] [char] (20) COLLATE Chinese_PRC_CI_AS NULL ,
	[funcid] [char] (20) COLLATE Chinese_PRC_CI_AS NULL ,
	[fc] [smallint] NULL ,
	[dr] [smallint] NULL ,
	[ts] [datetime] NULL ,
	[news_reads] [int] NULL ,
	[istop] [smallint] NULL ,
	[fileid] [char] (20) COLLATE Chinese_PRC_CI_AS NULL ,
	[oprflag] [smallint] NULL ,
	[news_key] [nvarchar] (100) COLLATE Chinese_PRC_CI_AS NULL ,
	[news_zy] [text] COLLATE Chinese_PRC_CI_AS NULL ,
	[fbflag] [smallint] NULL ,
	CONSTRAINT [PK_oa_news] PRIMARY KEY  CLUSTERED 
	(
		[newsid]
	)  ON [PRIMARY] 
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]



CREATE TABLE [oa_news_fj] (
	[fjid] [char] (20) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[newsid] [char] (20) COLLATE Chinese_PRC_CI_AS NULL ,
	[fj_type] [char] (10) COLLATE Chinese_PRC_CI_AS NULL ,
	[fj_name] [nvarchar] (200) COLLATE Chinese_PRC_CI_AS NULL ,
	[fj_path] [nvarchar] (200) COLLATE Chinese_PRC_CI_AS NULL ,
	[nrow] [smallint] NULL ,
	[ts] [datetime] NULL ,
	[fj_size] [int] NULL ,
	[pwd] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[fj_sourceid] [char] (20) COLLATE Chinese_PRC_CI_AS NULL ,
	CONSTRAINT [PK_oa_news_fj] PRIMARY KEY  CLUSTERED 
	(
		[fjid]
	)  ON [PRIMARY] 
) ON [PRIMARY]



CREATE TABLE [oa_news_pn] (
	[pnid] [char] (20) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[newsid] [char] (20) COLLATE Chinese_PRC_CI_AS NULL ,
	[userid] [char] (20) COLLATE Chinese_PRC_CI_AS NULL ,
	[pn_text] [text] COLLATE Chinese_PRC_CI_AS NULL ,
	[ts] [datetime] NULL ,
	CONSTRAINT [PK_oa_news_pn] PRIMARY KEY  CLUSTERED 
	(
		[pnid]
	)  ON [PRIMARY] 
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]

  


if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[oa_scheme]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[oa_scheme]


if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[oa_scheme_b]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[oa_scheme_b]



CREATE TABLE [oa_scheme] (
	[schemeid] [char] (20) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[sc_name] [nvarchar] (30) COLLATE Chinese_PRC_CI_AS NULL ,
	[userid] [char] (20) COLLATE Chinese_PRC_CI_AS NULL ,
	[ts] [datetime] NULL ,
	CONSTRAINT [PK_oa_scheme] PRIMARY KEY  CLUSTERED 
	(
		[schemeid]
	)  ON [PRIMARY] 
) ON [PRIMARY]



CREATE TABLE [oa_scheme_b] (
	[schemebid] [char] (20) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[schemeid] [char] (20) COLLATE Chinese_PRC_CI_AS NULL ,
	[userid] [char] (20) COLLATE Chinese_PRC_CI_AS NULL ,
	[ts] [datetime] NULL ,
	CONSTRAINT [PK_oa_scheme_b] PRIMARY KEY  CLUSTERED 
	(
		[schemebid]
	)  ON [PRIMARY] 
) ON [PRIMARY]


    
