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


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


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


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


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

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


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

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

CREATE TABLE [dbo].[Qwx_ALinks] (
	[LinkID] [int] IDENTITY (1, 1) NOT NULL PRIMARY KEY ,
	[LinkName] [nvarchar] (80) COLLATE Chinese_PRC_CI_AS NULL ,
	[LinkDes] [nvarchar] (200) COLLATE Chinese_PRC_CI_AS NULL ,
	[LinkUrl] [varchar] (120) COLLATE Chinese_PRC_CI_AS NULL 
)


CREATE TABLE [Qwx_Admin] (
	[AdminID] [int] IDENTITY (1, 1) NOT NULL PRIMARY KEY ,
	[IsSystem] [tinyint] NULL DEFAULT (0) ,
	[AdminName] [varchar] (120) COLLATE Chinese_PRC_CI_AS NULL ,
	[AdminPass] [varchar] (48) COLLATE Chinese_PRC_CI_AS NULL ,
	[LoginIP] [varchar] (40) COLLATE Chinese_PRC_CI_AS NULL ,
	[LoginTime] [datetime] NULL 
)



CREATE TABLE [Qwx_Column] (
	[ColumnID] [int] IDENTITY (1, 1) NOT NULL PRIMARY KEY ,
	[ParentID] [int] NULL DEFAULT (0) ,
	[Depth] [int] NULL DEFAULT (0) ,
	[OrderID] [int] NULL DEFAULT (1) ,
	[ColumnType] [int] NULL ,
	[ColumnName] [nvarchar] (80) COLLATE Chinese_PRC_CI_AS NULL ,
	[ColumnDir] [varchar] (80) COLLATE Chinese_PRC_CI_AS NULL ,
	[ColumnTemplate] [varchar] (100) COLLATE Chinese_PRC_CI_AS NULL ,
	[InfoTemplate] [varchar] (100) COLLATE Chinese_PRC_CI_AS NULL ,
	[Keywords] [nvarchar] (100) COLLATE Chinese_PRC_CI_AS NULL ,
	[Description] [nvarchar] (200) COLLATE Chinese_PRC_CI_AS NULL ,
	[VisitUrl] [varchar] (120) COLLATE Chinese_PRC_CI_AS NULL 
) 


CREATE TABLE [Qwx_Database] (
	[DbID] [int] IDENTITY (1, 1) NOT NULL PRIMARY KEY ,
	[DbName] [varchar] (20) COLLATE Chinese_PRC_CI_AS NULL ,
	[DbPath] [varchar] (100) COLLATE Chinese_PRC_CI_AS NULL ,
	[AddTime] [datetime] NULL 
)



CREATE TABLE [Qwx_Fail] (
	[FailID] [int] IDENTITY (1, 1) NOT NULL PRIMARY KEY ,
	[AdminName] [varchar] (120) COLLATE Chinese_PRC_CI_AS NULL ,
	[LoginIP] [varchar] (40) COLLATE Chinese_PRC_CI_AS NULL ,
	[LoginTime] [datetime] NULL ,
	[FailNum] [int] NULL DEFAULT (0) 
)


CREATE TABLE [Qwx_Info] (
	[InfoID] [int] IDENTITY (1, 1) NOT NULL PRIMARY KEY ,
	[ColumnID] [int] NULL DEFAULT (0) ,
	[IsAudit] [tinyint] NULL DEFAULT (0) ,
	[Title] [nvarchar] (80) COLLATE Chinese_PRC_CI_AS NULL ,
	[FontColor] [varchar] (7) COLLATE Chinese_PRC_CI_AS NULL ,
	[InfoPic] [varchar] (100) COLLATE Chinese_PRC_CI_AS NULL ,
	[Intro] [nvarchar] (200) COLLATE Chinese_PRC_CI_AS NULL ,
	[Content] [ntext] COLLATE Chinese_PRC_CI_AS NULL ,
	[Author] [nvarchar] (30) COLLATE Chinese_PRC_CI_AS NULL ,
	[CopyFrom] [nvarchar] (120) COLLATE Chinese_PRC_CI_AS NULL ,
	[IsPic] [tinyint] NULL DEFAULT (0) ,
	[IsElite] [tinyint] NULL DEFAULT (0) ,
	[ViewCount] [int] NULL DEFAULT (0) ,
	[PubTime] [datetime] NULL ,
	[AddTime] [datetime] NULL ,
	[Keywords] [nvarchar] (100) COLLATE Chinese_PRC_CI_AS NULL ,
	[Description] [nvarchar] (200) COLLATE Chinese_PRC_CI_AS NULL ,
	[VisitFile] [varchar] (120) COLLATE Chinese_PRC_CI_AS NULL ,
	[VisitUrl] [varchar] (120) COLLATE Chinese_PRC_CI_AS NULL 
)


CREATE TABLE [Qwx_Online] (
	[OnlineID] [int] IDENTITY (1, 1) NOT NULL PRIMARY KEY ,
	[AdminName] [varchar] (120) COLLATE Chinese_PRC_CI_AS NULL ,
	[OSessionID] [varchar] (64) COLLATE Chinese_PRC_CI_AS NULL ,
	[LoginIP] [varchar] (40) COLLATE Chinese_PRC_CI_AS NULL ,
	[LoginTime] [datetime] NULL ,
	[UpdateTime] [datetime] NULL 
)



CREATE TABLE [dbo].[Qwx_Label] (
	[LabelID] [int] IDENTITY (1, 1) NOT NULL PRIMARY KEY ,
	[IsSystem] [tinyint] NULL DEFAULT (0)  ,
	[OrderID] [int] NULL ,
	[LabelTitle] [nvarchar] (80) COLLATE Chinese_PRC_CI_AS NULL ,
	[LabelName] [varchar] (80) COLLATE Chinese_PRC_CI_AS NULL ,
	[LabelContent] [ntext] COLLATE Chinese_PRC_CI_AS NULL 
)