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

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

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

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

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

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

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

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

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

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

CREATE TABLE [dbo].[ad] (
	[id] [int] IDENTITY (1, 1) NOT NULL ,
	[ad_title] [varchar] (150) COLLATE Chinese_PRC_CI_AS NULL ,
	[links] [varchar] (150) COLLATE Chinese_PRC_CI_AS NULL ,
	[pic] [varchar] (150) COLLATE Chinese_PRC_CI_AS NULL ,
	[jscode] [varchar] (5000) COLLATE Chinese_PRC_CI_AS NULL ,
	[date1] [datetime] NULL ,
	[date2] [datetime] NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[admin] (
	[id] [int] IDENTITY (1, 1) NOT FOR REPLICATION  NOT NULL ,
	[admin] [varchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[password] [varchar] (150) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[levels] [varchar] (250) COLLATE Chinese_PRC_CI_AS NULL ,
	[date1] [datetime] NULL ,
	[wenti] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[daan] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[article] (
	[id] [int] IDENTITY (1, 1) NOT FOR REPLICATION  NOT NULL ,
	[titlenew] [varchar] (250) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[classid0] [int] NOT NULL ,
	[classid] [int] NOT NULL ,
	[nr] [ntext] COLLATE Chinese_PRC_CI_AS NULL ,
	[pic] [varchar] (250) COLLATE Chinese_PRC_CI_AS NULL ,
	[hot] [int] NULL ,
	[zuozhe] [varchar] (15) COLLATE Chinese_PRC_CI_AS NULL ,
	[tuijian] [bit] NULL ,
	[shenghe] [bit] NULL ,
	[date1] [datetime] NULL ,
	[titlecolor] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[laiyuan] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[Nkey] [varchar] (150) COLLATE Chinese_PRC_CI_AS NULL 
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO

CREATE TABLE [dbo].[help_1] (
	[id] [int] IDENTITY (1, 1) NOT FOR REPLICATION  NOT NULL ,
	[title1] [varchar] (150) COLLATE Chinese_PRC_CI_AS NULL ,
	[nr] [text] COLLATE Chinese_PRC_CI_AS NULL ,
	[date1] [datetime] NULL ,
	[biaoshi] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[lei] [int] NOT NULL ,
	[pic] [varchar] (150) COLLATE Chinese_PRC_CI_AS NULL ,
	[jianjie] [text] COLLATE Chinese_PRC_CI_AS NULL ,
	[xiangmu] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL 
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO

CREATE TABLE [dbo].[lanmu] (
	[id] [int] IDENTITY (1, 1) NOT FOR REPLICATION  NOT NULL ,
	[class] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[twoid] [int] NOT NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[lanmunr] (
	[id] [int] IDENTITY (1, 1) NOT FOR REPLICATION  NOT NULL ,
	[classid] [int] NOT NULL ,
	[title] [varchar] (800) COLLATE Chinese_PRC_CI_AS NULL ,
	[nr] [text] COLLATE Chinese_PRC_CI_AS NULL ,
	[date1] [datetime] NULL 
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO

CREATE TABLE [dbo].[new_class] (
	[id] [int] IDENTITY (1, 1) NOT FOR REPLICATION  NOT NULL ,
	[class] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[class1] [int] NOT NULL ,
	[pic] [int] NOT NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[setting] (
	[id] [int] IDENTITY (1, 1) NOT NULL ,
	[logo] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[webname] [varchar] (350) COLLATE Chinese_PRC_CI_AS NULL ,
	[webhost] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[keywords1] [varchar] (350) COLLATE Chinese_PRC_CI_AS NULL ,
	[keywords2] [varchar] (350) COLLATE Chinese_PRC_CI_AS NULL ,
	[keywords3] [varchar] (350) COLLATE Chinese_PRC_CI_AS NULL ,
	[foot] [text] COLLATE Chinese_PRC_CI_AS NULL ,
	[mobanpath] [varchar] (20) COLLATE Chinese_PRC_CI_AS NULL ,
	[address] [varchar] (250) COLLATE Chinese_PRC_CI_AS NULL ,
	[youbian] [int] NULL ,
	[tel] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[chuanzhen] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL 
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO

CREATE TABLE [dbo].[webpage_pro] (
	[id] [int] IDENTITY (1, 1) NOT FOR REPLICATION  NOT NULL ,
	[classid1] [int] NOT NULL ,
	[classid2] [int] NOT NULL ,
	[proname] [varchar] (150) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[proguige] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[projiage] [int] NOT NULL ,
	[pro_pic] [varchar] (150) COLLATE Chinese_PRC_CI_AS NULL ,
	[Nkey] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[date1] [datetime] NULL ,
	[miaoshu] [varchar] (4000) COLLATE Chinese_PRC_CI_AS NULL ,
	[Content] [text] COLLATE Chinese_PRC_CI_AS NULL ,
	[Content1] [text] COLLATE Chinese_PRC_CI_AS NULL ,
	[hot] [int] NOT NULL ,
	[ordername] [int] NOT NULL ,
	[shenghe] [bit] NULL ,
	[tuijian] [bit] NULL ,
	[userid] [int] NULL ,
	[titlecolor] [varchar] (10) COLLATE Chinese_PRC_CI_AS NULL ,
	[shiping] [bit] NULL 
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO

CREATE TABLE [dbo].[webpage_proclass] (
	[id] [int] IDENTITY (1, 1) NOT FOR REPLICATION  NOT NULL ,
	[classid1] [int] NOT NULL ,
	[classid2] [int] NOT NULL ,
	[class] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[pic] [int] NOT NULL 
) ON [PRIMARY]
GO

ALTER TABLE [dbo].[ad] ADD 
	CONSTRAINT [DF_ad_date1] DEFAULT (getdate()) FOR [date1],
	CONSTRAINT [DF_ad_date2] DEFAULT (getdate()) FOR [date2]
GO

ALTER TABLE [dbo].[admin] ADD 
	CONSTRAINT [DF_admin_date1] DEFAULT (getdate()) FOR [date1]
GO

ALTER TABLE [dbo].[article] ADD 
	CONSTRAINT [DF_article_classid0] DEFAULT (1) FOR [classid0],
	CONSTRAINT [DF_article_classid] DEFAULT (0) FOR [classid],
	CONSTRAINT [DF_article_hot] DEFAULT (0) FOR [hot],
	CONSTRAINT [DF_article_tuijian] DEFAULT (0) FOR [tuijian],
	CONSTRAINT [DF_article_shenghe] DEFAULT (0) FOR [shenghe],
	CONSTRAINT [DF_article_date1] DEFAULT (getdate()) FOR [date1]
GO

ALTER TABLE [dbo].[help_1] ADD 
	CONSTRAINT [DF_help_date1] DEFAULT (getdate()) FOR [date1],
	CONSTRAINT [DF_help_1_lei] DEFAULT (0) FOR [lei]
GO

ALTER TABLE [dbo].[lanmu] ADD 
	CONSTRAINT [DF_lanmu_twoid] DEFAULT (0) FOR [twoid]
GO

ALTER TABLE [dbo].[lanmunr] ADD 
	CONSTRAINT [DF_lanmunr_date1] DEFAULT (getdate()) FOR [date1]
GO

ALTER TABLE [dbo].[new_class] ADD 
	CONSTRAINT [DF_new_class_class1] DEFAULT (0) FOR [class1],
	CONSTRAINT [DF_new_class_pic] DEFAULT (1) FOR [pic]
GO

ALTER TABLE [dbo].[webpage_pro] ADD 
	CONSTRAINT [DF_webpage_pro_classid1] DEFAULT (0) FOR [classid1],
	CONSTRAINT [DF_webpage_pro_classid2] DEFAULT (0) FOR [classid2],
	CONSTRAINT [DF_webpage_pro_projiage] DEFAULT (0) FOR [projiage],
	CONSTRAINT [DF_webpage_pro_date1] DEFAULT (getdate()) FOR [date1],
	CONSTRAINT [DF_webpage_pro_hot] DEFAULT (0) FOR [hot],
	CONSTRAINT [DF_webpage_pro_ordername] DEFAULT (0) FOR [ordername],
	CONSTRAINT [DF_webpage_pro_userid] DEFAULT (0) FOR [userid]
GO

ALTER TABLE [dbo].[webpage_proclass] ADD 
	CONSTRAINT [DF_webpage_proclass_class1] DEFAULT (0) FOR [classid1],
	CONSTRAINT [DF_webpage_proclass_classid2] DEFAULT (0) FOR [classid2],
	CONSTRAINT [DF_webpage_proclass_pic] DEFAULT (1) FOR [pic]
GO

