CREATE TABLE [dbo].[DIR_Admin] (
	[AdminID] [int] NOT NULL ,
	[AdminName] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[AdminPass] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[AdminPurview] [int] NOT NULL ,
	[RndPassword] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[LastLoginTime] [datetime] NULL ,
	[LastLoginIP] [nvarchar] (15) COLLATE Chinese_PRC_CI_AS NULL ,
	[LoginTimes] [int] NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[DIR_Adver] (
	[AdverID] [int] NOT NULL ,
	[AdverName] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[AdverRGB] [nvarchar] (10) COLLATE Chinese_PRC_CI_AS NULL ,
	[AdverUrl] [nvarchar] (255) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[AdverIntro] [nvarchar] (255) COLLATE Chinese_PRC_CI_AS NULL ,
	[ExpiredTips] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[AdverDays] [int] NOT NULL ,
	[AdverTime] [datetime] NOT NULL ,
	[OrderID] [int] NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[DIR_Apply] (
	[ApplyID] [int] NOT NULL ,
	[ClassID] [int] NOT NULL ,
	[WebName] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[WebUrl] [nvarchar] (255) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[TagLabel] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[WebIntro] [ntext] COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[WebOwner] [nvarchar] (20) COLLATE Chinese_PRC_CI_AS NULL ,
	[WebEmail] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[OnlineQQ] [nvarchar] (20) COLLATE Chinese_PRC_CI_AS NULL ,
	[PostTime] [datetime] NULL 
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO

CREATE TABLE [dbo].[DIR_Class] (
	[ClassID] [int] NOT NULL ,
	[ParentID] [int] NOT NULL ,
	[ClassName] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[LinkUrl] [nvarchar] (255) COLLATE Chinese_PRC_CI_AS NULL ,
	[ClassKeys] [ntext] COLLATE Chinese_PRC_CI_AS NULL ,
	[ClassDesc] [ntext] COLLATE Chinese_PRC_CI_AS NULL ,
	[SiteNums] [int] NULL ,
	[OrderID] [int] NULL 
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO

CREATE TABLE [dbo].[DIR_FeedBack] (
	[FBackID] [int] NOT NULL ,
	[NickName] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[LinkMail] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[FeedBack] [ntext] COLLATE Chinese_PRC_CI_AS NULL ,
	[PostTime] [datetime] NULL 
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO

CREATE TABLE [dbo].[DIR_Labels] (
	[LabelID] [int] NOT NULL ,
	[LabelName] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[LabelIntro] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[LabelContent] [ntext] COLLATE Chinese_PRC_CI_AS NULL 
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO

CREATE TABLE [dbo].[DIR_Links] (
	[LinkID] [int] NOT NULL ,
	[LinkName] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[LinkUrl] [nvarchar] (255) COLLATE Chinese_PRC_CI_AS NULL ,
	[LogoUrl] [nvarchar] (255) COLLATE Chinese_PRC_CI_AS NULL ,
	[IsElite] [bit] NOT NULL ,
	[OrderID] [int] NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[DIR_NewKeys] (
	[KeyID] [int] NOT NULL ,
	[KeyText] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[KeyHits] [int] NULL ,
	[TodHits] [int] NULL ,
	[YesHits] [int] NULL ,
	[SoTime] [datetime] NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[DIR_Pages] (
	[PageID] [int] NOT NULL ,
	[PageName] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[PageIntro] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[PageContent] [ntext] COLLATE Chinese_PRC_CI_AS NULL 
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO

CREATE TABLE [dbo].[DIR_WebSite] (
	[WebID] [int] NOT NULL ,
	[ClassID] [int] NOT NULL ,
	[WebName] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[WebUrl] [nvarchar] (255) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[TagLabel] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[PhotoUrl] [nvarchar] (255) COLLATE Chinese_PRC_CI_AS NULL ,
	[WebIntro] [ntext] COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[WebOwner] [nvarchar] (20) COLLATE Chinese_PRC_CI_AS NULL ,
	[WebEmail] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[OnlineQQ] [nvarchar] (20) COLLATE Chinese_PRC_CI_AS NULL ,
	[PageRank] [int] NULL ,
	[AlexaRank] [int] NULL ,
	[InStat] [int] NULL ,
	[OutStat] [int] NULL ,
	[WebHits] [int] NULL ,
	[ErrNums] [int] NULL ,
	[IsElite] [bit] NOT NULL ,
	[Status] [int] NOT NULL ,
	[PostUser] [nvarchar] (20) COLLATE Chinese_PRC_CI_AS NULL ,
	[PostTime] [datetime] NULL 
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO

ALTER TABLE [dbo].[DIR_Admin] WITH NOCHECK ADD 
	CONSTRAINT [DF_DIR_Admin_LoginTimes] DEFAULT (0) FOR [LoginTimes],
	CONSTRAINT [PK_DIR_Admin] PRIMARY KEY  CLUSTERED 
	(
		[AdminID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[DIR_Adver] WITH NOCHECK ADD 
	CONSTRAINT [DF_DIR_Adver_AdverDays] DEFAULT (0) FOR [AdverDays],
	CONSTRAINT [DF_DIR_Adver_OrderID] DEFAULT (0) FOR [OrderID],
	CONSTRAINT [PK_DIR_Adver] PRIMARY KEY  CLUSTERED 
	(
		[AdverID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[DIR_Apply] WITH NOCHECK ADD 
	CONSTRAINT [DF_DIR_Apply_ClassID] DEFAULT (0) FOR [ClassID],
	CONSTRAINT [PK_DIR_Apply] PRIMARY KEY  CLUSTERED 
	(
		[ApplyID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[DIR_Class] WITH NOCHECK ADD 
	CONSTRAINT [DF_DIR_Class_ParentID] DEFAULT (0) FOR [ParentID],
	CONSTRAINT [DF_DIR_Class_SiteNums] DEFAULT (0) FOR [SiteNums],
	CONSTRAINT [DF_DIR_Class_OrderID] DEFAULT (0) FOR [OrderID],
	CONSTRAINT [PK_DIR_Class] PRIMARY KEY  CLUSTERED 
	(
		[ClassID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[DIR_FeedBack] WITH NOCHECK ADD 
	CONSTRAINT [PK_DIR_FeedBack] PRIMARY KEY  CLUSTERED 
	(
		[FBackID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[DIR_Labels] WITH NOCHECK ADD 
	CONSTRAINT [PK_DIR_Labels] PRIMARY KEY  CLUSTERED 
	(
		[LabelID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[DIR_Links] WITH NOCHECK ADD 
	CONSTRAINT [DF_DIR_Links_OrderID] DEFAULT (0) FOR [OrderID],
	CONSTRAINT [PK_DIR_Links] PRIMARY KEY  CLUSTERED 
	(
		[LinkID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[DIR_NewKeys] WITH NOCHECK ADD 
	CONSTRAINT [DF_DIR_NewKeys_KeyHits] DEFAULT (0) FOR [KeyHits],
	CONSTRAINT [DF_DIR_NewKeys_TodHits] DEFAULT (0) FOR [TodHits],
	CONSTRAINT [DF_DIR_NewKeys_YesHits] DEFAULT (0) FOR [YesHits],
	CONSTRAINT [PK_DIR_NewKeys] PRIMARY KEY  CLUSTERED 
	(
		[KeyID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[DIR_Pages] WITH NOCHECK ADD 
	CONSTRAINT [PK_DIR_Pages] PRIMARY KEY  CLUSTERED 
	(
		[PageID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[DIR_WebSite] WITH NOCHECK ADD 
	CONSTRAINT [DF_DIR_WebSite_ClassID] DEFAULT (0) FOR [ClassID],
	CONSTRAINT [DF_DIR_WebSite_PageRank] DEFAULT (0) FOR [PageRank],
	CONSTRAINT [DF_DIR_WebSite_AlexaRank] DEFAULT (0) FOR [AlexaRank],
	CONSTRAINT [DF_DIR_WebSite_InStat] DEFAULT (0) FOR [InStat],
	CONSTRAINT [DF_DIR_WebSite_OutStat] DEFAULT (0) FOR [OutStat],
	CONSTRAINT [DF_DIR_WebSite_WebHits] DEFAULT (0) FOR [WebHits],
	CONSTRAINT [DF_DIR_WebSite_ErrNums] DEFAULT (0) FOR [ErrNums],
	CONSTRAINT [PK_DIR_WebSite] PRIMARY KEY  CLUSTERED 
	(
		[WebID]
	)  ON [PRIMARY] 
GO

SET NOCOUNT ON 

Insert Into DIR_Admin (AdminID,AdminName,AdminPass,AdminPurview) Values (1,'35dir','1FB84AFD4AA142B3337A061735D82619',1)

SET NOCOUNT OFF
PRINT '数据库创建完成！'