
--1.公司证书
IF  EXISTS (SELECT * FROM sysobjects WHERE id = OBJECT_ID(N'[C_Certificate]') AND type in (N'U'))
DROP TABLE [C_Certificate]
BEGIN
CREATE TABLE [C_Certificate] (
[ID] [int]  IDENTITY (1, 1)  NOT NULL,
[UserID] [int]  NOT NULL,
[Name] [nvarchar]  (200) NOT NULL DEFAULT (''),
[URL] [nvarchar]  (400) NOT NULL DEFAULT (''),
[Organization] [nvarchar]  (100) NOT NULL DEFAULT (''),
[LicenceDate] [datetime]  NULL,
[ExpiryDate] [datetime]  NULL,
[AddDate] [datetime]  NOT NULL
 CONSTRAINT [PK_C_Certificate] PRIMARY KEY CLUSTERED 
(
	[ID] ASC
 )
  ON [PRIMARY]
) ON [PRIMARY]
END

--2.公司
IF EXISTS (SELECT * FROM sysobjects WHERE id = OBJECT_ID(N'[C_CorpInfo]') AND type in (N'U'))
DROP TABLE [C_CorpInfo]
BEGIN
CREATE TABLE [C_CorpInfo] (
[ID] [int]  NOT NULL,
[Name] [varchar]  (20) NULL,
[Nature] [varchar]  (20) NULL,
[BusinessModel] [varchar]  (20) NULL,
[DealinAdd] [varchar]  (50) NULL,
[Product] [varchar]  (50) NULL,
[Industry] [varchar]  (50) NULL,
[Summary] [varchar]  (500) NULL,
[Verify] [bigint]  NOT NULL DEFAULT (1),
[Region] [varchar]  (10) NULL,
[Province] [varchar]  (10) NULL,
[City] [varchar]  (10) NULL,
[County] [varchar]  (10) NULL,
[Street] [varchar]  (50) NULL,
[Postalcode] [varchar]  (10) NULL,
[URL] [varchar]  (50) NULL,
[Capital] [int]  NULL,
[Established] [datetime]  NULL,
[RegisterAddress] [varchar]  (100) NULL,
[Corporate] [varchar]  (10) NULL,
[StartDate] [datetime]  NULL,
[EndDate] [datetime]  NULL,
[Logo] [varchar]  (100) NULL
 CONSTRAINT [PK_C_CorpInfo] PRIMARY KEY CLUSTERED 
(
	[ID] ASC
) ON [PRIMARY]
) ON [PRIMARY]
END

--3.公司招聘信息
IF EXISTS (SELECT * FROM sysobjects WHERE id = OBJECT_ID(N'[C_Job]') AND type in (N'U'))
DROP TABLE [C_Job]
BEGIN
CREATE TABLE [C_Job] (
[ID] [int]  IDENTITY (1, 1)  NOT NULL,
[CorpID] [int]  NOT NULL,
[JobName] [nchar]  NOT NULL,
[Address] [varchar]  (50) NULL,
[Amount] [int]  NULL,
[Require] [varchar]  (200) NOT NULL,
[StartDate] [datetime]  NOT NULL,
[EndDate] [datetime]  NOT NULL,
[AddDate] [datetime]  NOT NULL
) ON [PRIMARY]
END

--4.公司留言
IF EXISTS (SELECT * FROM sysobjects WHERE id = OBJECT_ID(N'[C_Message]') AND type in (N'U'))
DROP TABLE [C_Message]
BEGIN
CREATE TABLE [C_Message] (
[ID] [int]  IDENTITY (1, 1)  NOT NULL,
[SendUserID] [int]  NOT NULL,
[Title] [nvarchar]  (100) NULL,
[Info] [ntext]  NULL,
[Date] [datetime]  NOT NULL DEFAULT (getdate()),
[Restore] [int]  NOT NULL DEFAULT (0),
[Nature] [nvarchar]  (100) NULL,
[ReceiveUserID] [int]  NOT NULL,
[TrashReceive] [bit]  NULL DEFAULT (0),
[TrashSend] [bit]  NULL DEFAULT (0),
[DelReceive] [bit]  NULL DEFAULT (0),
[DelSend] [bit]  NULL DEFAULT (0)
CONSTRAINT [PK_UserManage] PRIMARY KEY CLUSTERED 
(
    [ID] ASC
) ON [PRIMARY]
) ON [PRIMARY]
END

--5.公司资讯
IF EXISTS (SELECT * FROM sysobjects WHERE id = OBJECT_ID(N'[C_news]') AND type in (N'U'))
DROP TABLE [C_news]
BEGIN
CREATE TABLE [C_news] (
[ID] [int]  IDENTITY (1, 1)  NOT NULL,
[UserID] [int]  NULL,
[Title] [nvarchar]  (200) NULL,
[Info] [ntext]  NULL,
[Verify] [bit]  NULL DEFAULT (0),
[AddDate] [datetime]  NULL DEFAULT (getdate())
 CONSTRAINT [PK_C_news] PRIMARY KEY CLUSTERED 
(
	[ID] ASC
) ON [PRIMARY]
) ON [PRIMARY]
END

--6.公司系列
IF EXISTS (SELECT * FROM sysobjects WHERE id = OBJECT_ID(N'[C_ProType]') AND type in (N'U'))
DROP TABLE [C_ProType]
BEGIN
CREATE TABLE [C_ProType] (
[ID] [int]  IDENTITY (1, 1)  NOT NULL,
[UserID] [int]  NOT NULL,
[Name] [nvarchar]  (100) NOT NULL,
[SuperiorsID] [nchar]  NULL,
[Superiors] [varchar]  (50) NULL,
[Sequence] [int]  NULL DEFAULT (0),
[AddDate] [datetime]  NULL
 CONSTRAINT [PK_C_ProType] PRIMARY KEY CLUSTERED 
(
	[ID] ASC
) ON [PRIMARY]
) ON [PRIMARY]
END

--7.求购信息
IF EXISTS (SELECT * FROM sysobjects WHERE id = OBJECT_ID(N'[C_Purchase]') AND type in (N'U'))
DROP TABLE [C_Purchase]
BEGIN
CREATE TABLE [C_Purchase] (
[ID] [int]  IDENTITY (1, 1)  NOT NULL,
[UserID] [int]  NOT NULL,
[IsUser] [bit]  NULL DEFAULT (1),
[IndType] [varchar]  (50) NOT NULL,
[Name] [nvarchar]  (100) NOT NULL,
[Key] [nvarchar]  (100) NOT NULL,
[Info] [ntext]  NULL,
[Picture_1] [nvarchar]  (200) NULL,
[Picture_2] [nvarchar]  (200) NULL,
[Picture_3] [nvarchar]  (200) NULL,
[StartDate] [datetime]  NULL,
[EndDate] [datetime]  NULL,
[Brand] [nvarchar]  (40) NULL,
[Model] [nvarchar]  (100) NULL,
[AddDate] [datetime]  NOT NULL DEFAULT (getdate()),
[Verify] [int]  NULL,
[Recommend] [bit]  NULL DEFAULT (0),
[Obligate] [varchar]  (50) NULL,
[Thumbnail] [nvarchar]  (100) NULL,
[UserRecommend] [bit]  NULL DEFAULT (0),
[ClickCount] [int]  NULL,
[Unit] [nvarchar]  (100) NULL,
[Count] [int]  NULL,
[Price] [nvarchar]  (40) NULL
 CONSTRAINT [PK_C_Purchase] PRIMARY KEY CLUSTERED 
(
	[ID] ASC
) ON [PRIMARY]
) ON [PRIMARY]
END

--8.供应信息
IF EXISTS (SELECT * FROM sysobjects WHERE id = OBJECT_ID(N'[C_Supply]') AND type in (N'U'))
DROP TABLE [C_Supply]
BEGIN
CREATE TABLE [C_Supply] (
[ID] [int]  IDENTITY (1, 1)  NOT NULL,
[UserID] [int]  NOT NULL,
[IndType] [varchar]  (50) NOT NULL,
[Name] [nvarchar]  (100) NOT NULL DEFAULT (''),
[Key] [nvarchar]  (100) NOT NULL DEFAULT (''),
[Info] [ntext]  NOT NULL DEFAULT (''),
[Thumbnail] [nvarchar]  (100) NULL DEFAULT (''),
[Picture_1] [nvarchar]  (200) NOT NULL DEFAULT (''),
[Picture_2] [nvarchar]  (200) NULL DEFAULT (''),
[Picture_3] [nvarchar]  (200) NULL DEFAULT (''),
[ProType] [int]  NOT NULL,
[Place] [nvarchar]  (100) NOT NULL DEFAULT (''),
[Brand] [nvarchar]  (100) NULL DEFAULT (''),
[Model] [nvarchar]  (100) NULL DEFAULT (''),
[Price] [int]  NULL DEFAULT (0),
[Quantity] [int]  NULL DEFAULT (0),
[Units] [nvarchar]  (40) NULL DEFAULT (''),
[Minimum] [int]  NULL DEFAULT (0),
[Deadline] [int]  NULL DEFAULT (0),
[StartDate] [datetime]  NULL,
[EndDate] [datetime]  NULL,
[Remark] [nvarchar]  (100) NULL DEFAULT (''),
[Document] [nvarchar]  (100) NULL DEFAULT (''),
[AddDate] [datetime]  NOT NULL DEFAULT (getdate()),
[Verify] [smallint]  NULL,
[Recommend] [bit]  NULL DEFAULT (0),
[Attribute] [nvarchar]  (100) NULL DEFAULT (''),
[UserRecommend] [bit]  NULL,
[ClickCount] [int]  NULL
 CONSTRAINT [PK_C_Supply] PRIMARY KEY CLUSTERED 
(
	[ID] ASC
) ON [PRIMARY]
) ON [PRIMARY]
END

--9.我的收藏
IF EXISTS (SELECT * FROM sysobjects WHERE id = OBJECT_ID(N'[U_Favorites]') AND type in (N'U'))
DROP TABLE [U_Favorites]
BEGIN
CREATE TABLE [U_Favorites] (
[ID] [int]  IDENTITY (1, 1)  NOT NULL,
[ProductID] [int]  NULL,
[UserID] [int]  NULL,
[Type] [nvarchar]  (40) NULL
 CONSTRAINT [PK_U_Favorites] PRIMARY KEY CLUSTERED 
(
	[ID] ASC
) ON [PRIMARY]
) ON [PRIMARY]
END

--10.会员注册设置
IF EXISTS (SELECT * FROM sysobjects WHERE id = OBJECT_ID(N'[U_Register]') AND type in (N'U'))
DROP TABLE [U_Register]
BEGIN
CREATE TABLE [U_Register](
	[isRegister] [bit] NOT NULL,
	[ManageRegister] [bit] NULL,
	[VipGrade] [int] NULL,
	[isCode] [bit] NULL,
	[isQuestion] [bit] NOT NULL,
	[Question] [nvarchar](500) COLLATE Chinese_PRC_CI_AS NULL,
	[Answer] [nvarchar](500) COLLATE Chinese_PRC_CI_AS NULL,
	[BannedIP] [nvarchar](500) COLLATE Chinese_PRC_CI_AS NULL,
	[BannedUser] [nvarchar](500) COLLATE Chinese_PRC_CI_AS NULL,
	[Code_Login] [bit] NOT NULL,
	[Code_GetPass] [bit] NULL,
	[GetPass_Count] [smallint] NOT NULL,
	[Minimum] [smallint] NOT NULL,
	[Longest] [smallint] NOT NULL,
	[MinTimeRegister] [int] NOT NULL,
	[Gocipher_Method] [smallint] NOT NULL,
	[OnlyUser_Email] [bit] NOT NULL,
	[ToMessage] [bit] NOT NULL,
	[MessageInfo] [nvarchar](1000) COLLATE Chinese_PRC_CI_AS NOT NULL,
	[ToEmail] [bit] NOT NULL,
	[EmailInfo] [nvarchar](1000) COLLATE Chinese_PRC_CI_AS NOT NULL
) ON [PRIMARY]
END

--11.公司详细信息
IF EXISTS (SELECT * FROM sysobjects WHERE id = OBJECT_ID(N'[U_UserInfo]') AND type in (N'U'))
DROP TABLE [U_UserInfo]
BEGIN
CREATE TABLE [U_UserInfo] (
[UserID] [int]  IDENTITY (1, 1)  NOT NULL,
[LoginName] [nvarchar]  (40) NOT NULL DEFAULT (''),
[Sex] [nvarchar]  (20) NOT NULL DEFAULT (''),
[Password] [varchar]  (50) NOT NULL,
[Question] [nvarchar]  (100) NOT NULL DEFAULT (''),
[Answer] [nvarchar]  (100) NOT NULL DEFAULT (''),
[GradeID] [int]  NULL DEFAULT (0),
[Lockedup] [bit]  NULL DEFAULT (1),
[LinkName] [nvarchar]  (20) NOT NULL DEFAULT (''),
[MobilePhone] [varchar]  (15) NULL DEFAULT (''),
[Email] [varchar]  (30) NULL DEFAULT (''),
[QQ] [varchar]  (15) NULL DEFAULT (''),
[MSN] [varchar]  (50) NULL DEFAULT (''),
[Tel_International] [varchar]  (5) NULL DEFAULT (86),
[Tel_DistrictNumber] [varchar]  (5) NULL DEFAULT (''),
[Tel_Telephone] [varchar]  (10) NULL DEFAULT (''),
[Tel_Ext] [varchar]  (10) NULL DEFAULT (''),
[Fax_International] [varchar]  (5) NULL DEFAULT (''),
[Fax_DistrictNumber] [varchar]  (5) NULL DEFAULT (''),
[Fax_Telephone] [varchar]  (10) NULL DEFAULT (''),
[Fax_Ext] [varchar]  (10) NULL DEFAULT (''),
[Department] [nvarchar]  (40) NULL DEFAULT (''),
[Position] [nvarchar]  (20) NULL DEFAULT (''),
[RegDate] [datetime]  NOT NULL DEFAULT (getdate()),
[CompanyName] [nvarchar]  (100) NOT NULL DEFAULT (''),
[CompanyNature] [nvarchar]  (40) NOT NULL DEFAULT (''),
[BusinessModel] [nvarchar]  (40) NOT NULL DEFAULT (''),
[DealinAdd] [nvarchar]  (100) NOT NULL DEFAULT (''),
[Product] [nvarchar]  (100) NOT NULL DEFAULT (''),
[Industry] [nvarchar]  (100) NOT NULL DEFAULT (''),
[Summary] [ntext]  NOT NULL DEFAULT (''),
[Verify] [bit]  NOT NULL DEFAULT (0),
[Country] [nvarchar]  (40) NULL DEFAULT (''),
[Province] [nvarchar]  (20) NULL DEFAULT (''),
[City] [nvarchar]  (20) NULL DEFAULT (''),
[Area] [nvarchar]  (40) NULL DEFAULT (''),
[Street] [nvarchar]  (100) NULL DEFAULT (''),
[Postalcode] [varchar]  (10) NULL DEFAULT (''),
[URL] [nvarchar]  (100) NULL DEFAULT (''),
[Capital] [int]  NULL DEFAULT (0),
[Established] [datetime]  NULL DEFAULT (getdate()),
[RegisterAddress] [nvarchar]  (100) NULL DEFAULT (''),
[Corporate] [nvarchar]  (20) NULL DEFAULT (''),
[StartDate] [datetime]  NULL DEFAULT (getdate()),
[EndDate] [datetime]  NULL,
[Logo] [nvarchar]  (200) NULL DEFAULT ('')
 CONSTRAINT [PK_U_UserInfo] PRIMARY KEY CLUSTERED 
(
	[UserID] ASC
) ON [PRIMARY]
) ON [PRIMARY]
END

--12.会员友情链接
IF EXISTS (SELECT * FROM sysobjects WHERE id = OBJECT_ID(N'[U_UserLink]') AND type in (N'U'))
DROP TABLE [U_UserLink]
BEGIN
CREATE TABLE [U_UserLink] (
[ID] [int]  IDENTITY (1, 1)  NOT NULL,
[UserID] [int]  NOT NULL,
[Name] [nvarchar]  (100) NOT NULL,
[Url] [nvarchar]  (100) NULL,
[Logo] [nvarchar]  (200) NULL,
[Verify] [bit]  NULL DEFAULT (0),
[AddDate] [datetime]  NULL DEFAULT (getdate())
 CONSTRAINT [PK_U_UserLink] PRIMARY KEY CLUSTERED 
(
	[ID] ASC
) ON [PRIMARY]
) ON [PRIMARY]
END

--13.会员日常操作
IF EXISTS (SELECT * FROM sysobjects WHERE id = OBJECT_ID(N'[U_UserOperate]') AND type in (N'U'))
DROP TABLE [U_UserOperate]
BEGIN
CREATE TABLE [U_UserOperate] (
[UserID] [int]  NOT NULL,
[Template_Old] [nvarchar]  (40) NULL,
[Template_New] [nvarchar]  (40) NULL,
[LoginCount] [int]  NULL,
[SupplyCount] [int]  NULL DEFAULT (0),
[PurchaseCount] [int]  NULL DEFAULT (0),
[ExpoCount] [int]  NULL DEFAULT (0),
[SincereAgentCount] [int]  NULL DEFAULT (0),
[WillAgentCount] [int]  NULL DEFAULT (0),
[Mark] [int]  NULL DEFAULT (0),
[LastLogonTime] [datetime]  NULL,
[LastLogonIP] [varchar]  (50) NULL,
[CircleCount] [int]  NULL DEFAULT (0),
[Nowdate] [datetime]  NULL DEFAULT (getdate()),
[AddSupply] [int]  NULL DEFAULT (0),
[AddPurchase] [int]  NULL DEFAULT (0),
[AddExpo] [int]  NULL DEFAULT (0),
[AddSincereAgent] [int]  NULL DEFAULT (0),
[AddWillAgent] [int]  NULL DEFAULT (0)
 CONSTRAINT [PK_U_UserOperate] PRIMARY KEY CLUSTERED 
(
	[UserID] ASC
) ON [PRIMARY]
) ON [PRIMARY]
END

--14.会员等级
IF EXISTS (SELECT * FROM sysobjects WHERE id = OBJECT_ID(N'[U_VipGrade]') AND type in (N'U'))
DROP TABLE [U_VipGrade]
BEGIN
CREATE TABLE [U_VipGrade] (
[ID] [int]  IDENTITY (1, 1)  NOT NULL,
[Name] [nvarchar]  (40) NOT NULL DEFAULT (''),
[Flag] [nvarchar]  (100) NOT NULL DEFAULT (''),
[ServiceTime] [int]  NOT NULL DEFAULT (12),
[Price] [int]  NOT NULL DEFAULT (0),
[Register] [bit]  NOT NULL DEFAULT (0),
[ManageRights] [varchar]  (2) NOT NULL DEFAULT (0),
[SupplyCount] [int]  NOT NULL DEFAULT (0),
[PurchaseCount] [int]  NOT NULL DEFAULT (0),
[ExpoCount] [int]  NOT NULL DEFAULT (0),
[SincereCount] [int]  NOT NULL DEFAULT (0),
[WillCount] [int]  NOT NULL DEFAULT (0),
[ShopTemplate] [nvarchar]  (100) NULL,
[CircleCount] [int]  NULL DEFAULT (0),
[Mark] [int]  NULL DEFAULT (0),
[Sort] [int]  NULL DEFAULT (0)
 CONSTRAINT [PK_VipGrade] PRIMARY KEY CLUSTERED 
(
	[ID] ASC
) ON [PRIMARY]
) ON [PRIMARY]
END

--15.上传图片
IF EXISTS (SELECT * FROM sysobjects WHERE id= OBJECT_ID(N'[U_C_Picture]') AND type in (N'U'))
DROP TABLE [U_C_Picture]
BEGIN
CREATE TABLE [U_C_Picture](
[ID] [int] IDENTITY(1,1) NOT NULL,
[CircleID] [int] NOT NULL,
[MemberID] [int] NOT NULL,
[TypeID] [int] NULL,
[Picture] [varchar](200) COLLATE Chinese_PRC_CI_AS NOT NULL,
[Explain] [nvarchar](50) COLLATE Chinese_PRC_CI_AS NULL,
[AddDate] [datetime] NOT NULL CONSTRAINT [DF_U_C_Picture_AddDate]  DEFAULT (getdate()) 
 CONSTRAINT [PK_U_C_Picture] PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)ON [PRIMARY]
) ON [PRIMARY]
END

--16.讨论区
IF EXISTS (SELECT * FROM sysobjects WHERE id= OBJECT_ID(N'[U_C_Discussion]') AND type in (N'U'))
DROP TABLE [U_C_Discussion]
BEGIN
CREATE TABLE [U_C_Discussion] (
[TopicID] [int]  IDENTITY (1, 1)  NOT NULL,
[CircleID] [int]  NOT NULL,
[MemberID] [int]  NOT NULL,
[Subject] [nvarchar]  (100) NOT NULL,
[Picture] [nvarchar]  (200) NULL,
[Message] [text]  NULL,
[PithTopic] [bit]  NULL,
[TopTopic] [bit]  NULL,
[PrivateTopic] [bit]  NULL,
[WebPith] [bit]  NULL,
[WebTop] [bit]  NULL,
[Recommend] [bit]  NULL,
[VisitCapacity] [int]  NULL,
[AddDate] [datetime]  NOT NULL DEFAULT (getdate())
 CONSTRAINT [PK_U_C_Discussion] PRIMARY KEY CLUSTERED 
(
	[TopicID] ASC
) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
END

--17.创建商圈
IF EXISTS (SELECT * FROM sysobjects WHERE id = OBJECT_ID(N'[U_C_BusinessCircle]') AND type in (N'U'))
DROP TABLE [U_C_BusinessCircle]
BEGIN
CREATE TABLE [U_C_BusinessCircle](
	[CircleID] [int] IDENTITY(10000,1) NOT NULL,
	[UserID] [int] NOT NULL,
	[CircleName] [nvarchar](50) NOT NULL,
	[TypeID] [int] NOT NULL,
	[Introduce] [nvarchar](500) NULL,
	[Post] [nvarchar](500) NULL,
	[Tag] [nvarchar](50) NULL,
	[Picture] [nvarchar](200) NULL,
	[Recommend] [bit] NULL,
	[VisitCapacity] [int] NULL,
	[Rights] [nvarchar](10) NULL CONSTRAINT [DF_U_C_BusinessCircle_Rights]  DEFAULT ((1)),
	[AddDate] [datetime] NOT NULL CONSTRAINT [DF_U_C_BusinessCircle_AddDate]  DEFAULT (getdate()),
 CONSTRAINT [PK_U_C_BusinessCircle] PRIMARY KEY CLUSTERED 
(
	[CircleID] ASC
)ON [PRIMARY]
) ON [PRIMARY]
END

--18.话题回复
IF EXISTS (SELECT * FROM sysobjects WHERE id= OBJECT_ID(N'[U_C_Replies]') AND type in (N'U'))
DROP TABLE [U_C_Replies]
BEGIN
CREATE TABLE [U_C_Replies](
	[ID] [int] IDENTITY(1,1) NOT NULL,
	[CircleID] [int] NOT NULL,
	[TopicID] [int] NOT NULL,
	[MemberID] [int] NOT NULL,
	[Message] [nvarchar](300) NOT NULL,
	[Picture] [nvarchar](100) NULL,
	[AddDate] [datetime] NOT NULL CONSTRAINT [DF_U_C_Replies_AddDate]  DEFAULT (getdate()),
 CONSTRAINT [PK_U_C_Replies_1] PRIMARY KEY CLUSTERED 
(
	[ID] ASC
) ON [PRIMARY]
) ON [PRIMARY]
END

--19.商圈成员
IF EXISTS (SELECT * FROM sysobjects WHERE id= OBJECT_ID(N'[U_C_Member]') AND type in (N'U'))
DROP TABLE [U_C_Member]
BEGIN
CREATE TABLE [U_C_Member](
	[ID] [int] IDENTITY(1,1) NOT NULL,
	[CircleID] [int] NOT NULL,
	[MemberID] [int] NOT NULL,
	[LoginName] [nvarchar](50) NULL,
	[Flag] [nvarchar](50) NULL,
	[AddDate] [datetime] NULL CONSTRAINT [DF_U_C_Member_AddDate]  DEFAULT (getdate()),
 CONSTRAINT [PK_U_C_Member] PRIMARY KEY CLUSTERED 
(
	[ID] ASC
) ON [PRIMARY]
) ON [PRIMARY]
END

--20.留言板
IF EXISTS (SELECT * FROM sysobjects WHERE id= OBJECT_ID(N'[U_C_MessageBoard]') AND type in (N'U'))
DROP TABLE [U_C_MessageBoard]
BEGIN
CREATE TABLE [U_C_MessageBoard](
	[ID] [int] IDENTITY(1,1) NOT NULL,
	[CircleID] [int] NOT NULL,
	[MemberID] [int] NOT NULL,
	[Message] [nvarchar](500) NOT NULL,
	[AddDate] [datetime] NOT NULL CONSTRAINT [DF_U_C_MessageBoard_AddDate]  DEFAULT (getdate()),
 CONSTRAINT [PK_U_C_MessageBoard] PRIMARY KEY CLUSTERED 
(
	[ID] ASC
) ON [PRIMARY]
) ON [PRIMARY]
END

--21.图片所属专辑
IF EXISTS (SELECT * FROM sysobjects WHERE id= OBJECT_ID(N'[U_C_PictureType]') AND type in (N'U'))
DROP TABLE [U_C_PictureType]
BEGIN
CREATE TABLE [U_C_PictureType](
	[ID] [int] IDENTITY(1,1) NOT NULL,
	[CircleID] [int] NOT NULL,
	[Name] [nvarchar](20) NOT NULL,
	[MemberID] [int] NULL,
	[AddDate] [datetime] NULL
) ON [PRIMARY]
END

--22.商圈类别
IF EXISTS (SELECT * FROM sysobjects WHERE id= OBJECT_ID(N'[U_C_CircleType]') AND type in (N'U'))
DROP TABLE [U_C_CircleType]
BEGIN
CREATE TABLE [U_C_CircleType](
	[ID] [int] IDENTITY(1,1) NOT NULL,
	[Name] [nvarchar](20) NOT NULL,
 CONSTRAINT [PK_U_C_CircleType] PRIMARY KEY CLUSTERED 
(
	[ID] ASC
) ON [PRIMARY]
) ON [PRIMARY]
END

--23.会员注册
IF EXISTS (SELECT * FROM sysobjects WHERE id= OBJECT_ID(N'[U_RegisterIP]') AND type in (N'U'))
DROP TABLE [U_RegisterIP]
BEGIN
CREATE TABLE [U_RegisterIP] (
[ID] [int]  IDENTITY (1, 1)  NOT NULL,
[IP] [nvarchar]  (100) NOT NULL,
[LastTIme] [datetime]  NOT NULL
) ON [PRIMARY]
END

--24.广告位表
IF EXISTS (SELECT * FROM sysobjects WHERE id= OBJECT_ID(N'[W_Ad_Table]') AND type in (N'U'))
DROP TABLE [W_Ad_Table]
BEGIN
CREATE TABLE [W_Ad_Table] (
[T_ID] [int]  IDENTITY (1, 1)  NOT NULL,
[Ad_Type] [varchar]  (20) NULL,
[Ad_Name] [varchar]  (50) NULL,
[Ad_Page] [varchar]  (30) NULL,
[Ad_Height] [int]  NULL,
[Ad_Width] [int]  NULL,
[Ad_ImageAdrees] [varchar]  (200) NULL,
[Ad_Adrees] [varchar]  (200) NULL,
[DayMode] [int]  NULL,
[DayMoney] [money]  NULL,
[User_ID] [int]  NULL,
[M_ID] [int]  NULL,
[Ad_StartDate] [datetime]  NULL,
[Ad_AddDate] [datetime]  NULL
 CONSTRAINT [PK_W_Ad_Table] PRIMARY KEY CLUSTERED 
(
	[T_ID] ASC
) ON [PRIMARY]
) ON [PRIMARY]
END

--25.用户申请广告信息表
IF EXISTS (SELECT * FROM sysobjects WHERE id= OBJECT_ID(N'[W_Ad_MemberInfo]') AND type in (N'U'))
DROP TABLE [W_Ad_MemberInfo]
BEGIN
CREATE TABLE [W_Ad_MemberInfo](
	[M_ID] [int] IDENTITY(1,1) NOT NULL,
	[User_ID] [int] NOT NULL,
	[T_ID] [int] NOT NULL,
	[Ad_MemberInfoName] [nvarchar](50) COLLATE Chinese_PRC_CI_AS NULL,
	[Ad_Adrees] [nvarchar](200) COLLATE Chinese_PRC_CI_AS NULL,
	[Ad_Leter] [nvarchar](50) COLLATE Chinese_PRC_CI_AS NULL,
	[Ad_ImageAdrees] [nvarchar](200) COLLATE Chinese_PRC_CI_AS NULL,
	[Ad_Note] [nvarchar](100) COLLATE Chinese_PRC_CI_AS NULL,
	[Ad_AddDate] [datetime] NULL,
	[Ad_Day] [int] NULL,
	[Ad_Auditing] [varchar](10) COLLATE Chinese_PRC_CI_AS NULL CONSTRAINT [DF_W_Ad_MemberInfo_Ad_Auditing]  DEFAULT ('未通过'),
	[Ad_RestrictTime] [nchar](10) COLLATE Chinese_PRC_CI_AS NULL CONSTRAINT [DF_W_Ad_MemberInfo_Ad_RestrictTime]  DEFAULT ('未发布'),
	[Ad_IsDelete] [bit] NULL,
	[Ad_StartDate] [datetime] NULL,
	[UM_Name] [nchar](20) COLLATE Chinese_PRC_CI_AS NULL,
	[UM_Sign] [nvarchar](5) COLLATE Chinese_PRC_CI_AS NULL CONSTRAINT [DF_W_Ad_MemberInfo_UM_Sign]  DEFAULT (N'会员') 

 CONSTRAINT [PK_W_Ad_MemberInfo] PRIMARY KEY CLUSTERED 
(
	[M_ID] ASC
) ON [PRIMARY]
) ON [PRIMARY]
END

--26.创业加盟类别
IF EXISTS (SELECT * FROM sysobjects WHERE id = OBJECT_ID(N'[W_AgentType]') AND type in (N'U'))
DROP TABLE [W_AgentType]
BEGIN
CREATE TABLE [W_AgentType] (
[ID] [int]  IDENTITY (1, 1)  NOT NULL,
[Name] [nvarchar]  (40) NULL,
[ParentID] [int]  NULL,
[FullID] [varchar]  (50) NULL,
[UnderlingFlag] [bigint]  NULL,
[Compositor] [int]  NULL DEFAULT (0)
 CONSTRAINT [PK_W_AgentType] PRIMARY KEY CLUSTERED 
(
	[ID] ASC
) ON [PRIMARY]
) ON [PRIMARY]
END

--27.地区
IF  EXISTS (SELECT * FROM sysobjects WHERE id= OBJECT_ID(N'[W_Area]') AND type in (N'U'))
DROP TABLE [W_Area]
BEGIN
CREATE TABLE [W_Area] (
[ID] [int]  IDENTITY (1, 1)  NOT NULL,
[Name] [nvarchar]  (100) NULL,
[ParentID] [int]  NULL,
[FullID] [nvarchar]  (40) NULL,
[Grade] [int]  NULL,
[UnderlingFlag] [bit]  NULL DEFAULT (0),
[Sequence] [int]  NULL,
[code] [nvarchar]  (12) NULL,
[cityId] [nvarchar]  (12) NULL,
[provinceId] [nvarchar]  (12) NULL
) ON [PRIMARY]
END

--28.品牌类别
IF  EXISTS (SELECT * FROM sysobjects WHERE id= OBJECT_ID(N'[W_Brand]') AND type in (N'U'))
DROP TABLE [W_Brand]
BEGIN
CREATE TABLE [W_Brand] (
[ID] [int]  IDENTITY (1, 1)  NOT NULL,
[Name] [nvarchar]  (100) NOT NULL,
[IndTypeID] [int]  NULL,
[AddDate] [datetime]  NULL DEFAULT (getdate())
 CONSTRAINT [PK_W_Brand] PRIMARY KEY CLUSTERED 
(
	[ID] ASC
) ON [PRIMARY]
) ON [PRIMARY]
END

--29.商业信息设置
IF  EXISTS (SELECT * FROM sysobjects WHERE id= OBJECT_ID(N'[W_BusinessInfoSet]') AND type in (N'U'))
DROP TABLE [W_BusinessInfoSet]
BEGIN
CREATE TABLE [W_BusinessInfoSet] (
[VerifyAdd] [bit]  NOT NULL DEFAULT (0),
[VerifyEdit] [bit]  NOT NULL DEFAULT (0),
[Email] [bit]  NOT NULL DEFAULT (0),
[Message] [bit]  NOT NULL DEFAULT (0),
[MessageTitle] [nvarchar]  (100) NULL,
[MessageInfo] [nvarchar]  (1000) NULL,
[EmailTitle] [nvarchar]  (100) NULL,
[EmailInfo] [nvarchar]  (1000) NULL,
[MarkAdd] [smallint]  NOT NULL DEFAULT (0),
[MarkEdit] [smallint]  NOT NULL DEFAULT (0)
) ON [PRIMARY]
END

--30.网站Meta(优化)信息
IF EXISTS (SELECT * FROM sysobjects WHERE id= OBJECT_ID(N'[W_MetaInfo]') AND type in (N'U'))
DROP TABLE [W_MetaInfo]
BEGIN
CREATE TABLE [W_MetaInfo] (
[ID] [int]  IDENTITY (1, 1)  NOT NULL,
[TypeID] [int]  NULL,
[Keywords] [nvarchar]  (1000) NULL,
[Descriptions] [nvarchar]  (1000) NULL
 CONSTRAINT [PK_W_MetaInfo] PRIMARY KEY CLUSTERED 
(
	[ID] ASC
) ON [PRIMARY]
) ON [PRIMARY]
END

--31.网站角色
IF  EXISTS (SELECT * FROM sysobjects WHERE id= OBJECT_ID(N'[W_Role]') AND type in (N'U'))
DROP TABLE [W_Role]
BEGIN
CREATE TABLE [W_Role] (
[ID] [int]  IDENTITY (1, 1)  NOT NULL,
[RoleName] [varchar]  (20) NOT NULL,
[Basic] [varchar]  (100) NULL,
[Column] [varchar]  (100) NULL,
[User] [varchar]  (100) NULL,
[Template] [varchar]  (100) NULL,
[System] [varchar]  (100) NULL,
[Describe] [nvarchar]  (1000) NULL,
[Authorize] [bit]  NOT NULL DEFAULT (1),
[AddDate] [datetime]  NOT NULL DEFAULT (getdate())
 CONSTRAINT [PK_W_Role] PRIMARY KEY CLUSTERED 
(
	[ID] ASC
) ON [PRIMARY]
) ON [PRIMARY]
END

--32.网站信息管理
IF EXISTS (SELECT * FROM sysobjects WHERE id= OBJECT_ID(N'[W_WebNews]') AND type in (N'U'))
DROP TABLE [W_WebNews]
BEGIN
CREATE TABLE [W_WebNews] (
[ID] [int]  IDENTITY (1, 1)  NOT NULL,
[Title] [nvarchar]  (40) NOT NULL,
[Type] [nvarchar]  (40) NOT NULL,
[Attribute] [nvarchar]  (100) NULL,
[Picture] [varchar]  (50) NULL,
[Origin] [nvarchar]  (100) NOT NULL,
[Detail] [ntext]  NULL,
[AddDate] [datetime]  NOT NULL DEFAULT (getdate())
 CONSTRAINT [PK_W_PostInfo] PRIMARY KEY CLUSTERED 
(
	[ID] ASC
) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
END

--33.系统后台管理安全日志
IF  EXISTS (SELECT * FROM sysobjects WHERE id= OBJECT_ID(N'[W_ManagerCount]') AND type in (N'U'))
DROP TABLE [W_ManagerCount]
BEGIN
CREATE TABLE [W_ManagerCount] (
[ID] [int]  IDENTITY (1, 1)  NOT NULL,
[IP] [varchar]  (50) NULL,
[StartDate] [datetime]  NULL,
[LastDate] [datetime]  NULL,
[SuccessCount] [int]  NULL,
[DefeatCount] [int]  NULL,
[ManagerName] [nvarchar]  (40) NULL
 CONSTRAINT [PK_W_ManagerCount] PRIMARY KEY CLUSTERED 
(
	[ID] ASC
) ON [PRIMARY]
) ON [PRIMARY]
END

--34.展会资讯类别
IF EXISTS (SELECT * FROM sysobjects WHERE id= OBJECT_ID(N'[W_ExpoNewsType]') AND type in (N'U'))
DROP TABLE [W_ExpoNewsType]
BEGIN
CREATE TABLE [W_ExpoNewsType] (
[ID] [int]  IDENTITY (1, 1)  NOT NULL,
[Type] [nvarchar]  (100) NULL
 CONSTRAINT [PK_W_ExpoNewsType] PRIMARY KEY CLUSTERED 
(
	[ID] ASC
) ON [PRIMARY]
) ON [PRIMARY]
END

--35.展会类别
IF  EXISTS (SELECT * FROM sysobjects WHERE id= OBJECT_ID(N'[W_ExpoType]') AND type in (N'U'))
DROP TABLE [W_ExpoType]
BEGIN
CREATE TABLE [W_ExpoType] (
[ID] [int]  IDENTITY (1, 1)  NOT NULL,
[Type] [nvarchar]  (100) NULL
 CONSTRAINT [PK_W_ExpoType] PRIMARY KEY CLUSTERED 
(
	[ID] ASC
) ON [PRIMARY]
) ON [PRIMARY]
END

--36.网站基本设置
IF  EXISTS (SELECT * FROM sysobjects WHERE id= OBJECT_ID(N'[W_WebBasic]') AND type in (N'U'))
DROP TABLE [W_WebBasic]
BEGIN
CREATE TABLE [W_WebBasic](
	[ID] [int] IDENTITY(1,1) NOT NULL,
	[SystemTel] [varchar](20) COLLATE Chinese_PRC_CI_AS NULL,
	[HotTel] [varchar](20) COLLATE Chinese_PRC_CI_AS NULL,
	[FaxTel] [varchar](20) COLLATE Chinese_PRC_CI_AS NULL,
	[CorporationName] [nvarchar](50) COLLATE Chinese_PRC_CI_AS NULL,
	[Receiver] [nvarchar](50) COLLATE Chinese_PRC_CI_AS NULL,
	[Address] [nvarchar](50) COLLATE Chinese_PRC_CI_AS NULL,
	[PostalCode] [varchar](10) COLLATE Chinese_PRC_CI_AS NULL,
	[BankAccount] [varchar](50) COLLATE Chinese_PRC_CI_AS NULL,
	[BankName] [nvarchar](20) COLLATE Chinese_PRC_CI_AS NULL,
	[KeyWordCount] [int] NULL,
	[Email] [varchar](50) COLLATE Chinese_PRC_CI_AS NULL,
	[EmailName] [nvarchar](20) COLLATE Chinese_PRC_CI_AS NULL,
	[EmailPass] [varchar](20) COLLATE Chinese_PRC_CI_AS NULL,
	[SMTP] [nvarchar](50) COLLATE Chinese_PRC_CI_AS NULL,
	[State] [int] NULL,
	[StopReadme] [nvarchar](500) COLLATE Chinese_PRC_CI_AS NULL,
	[WebName] [nvarchar](50) COLLATE Chinese_PRC_CI_AS NULL,
	[WebURL] [varchar](50) COLLATE Chinese_PRC_CI_AS NULL,
	[Catalog] [varchar](50) COLLATE Chinese_PRC_CI_AS NULL,
	[isBlog] [bit] NULL CONSTRAINT [DF_W_WebBasic_isBlog]  DEFAULT (0),
	[isSecondURL] [bit] NULL CONSTRAINT [DF_W_WebBasic_isSecondUrl]  DEFAULT (0),
	[isForum] [bit] NULL CONSTRAINT [DF_W_WebBasic_isForum]  DEFAULT (0),
	[Copyright] [nvarchar](500) COLLATE Chinese_PRC_CI_AS NULL,
	[Record] [nvarchar](50) COLLATE Chinese_PRC_CI_AS NULL,
	[WebLOGO] [varchar](100) COLLATE Chinese_PRC_CI_AS NULL,
	[Filter] [nvarchar](1000) COLLATE Chinese_PRC_CI_AS NULL,
	[Rewrite] [nvarchar](50) COLLATE Chinese_PRC_CI_AS NULL,
	[LoginName] [nvarchar](50) COLLATE Chinese_PRC_CI_AS NULL,
	[AdminUserID] [int] NULL,
	[Encryption] [nvarchar](20) COLLATE Chinese_PRC_CI_AS NULL,
 CONSTRAINT [PK_W_Basic] PRIMARY KEY CLUSTERED 
(
	[ID] ASC
) ON [PRIMARY]
) ON [PRIMARY]
END

--37.商机信息设置
IF EXISTS (SELECT * FROM sysobjects WHERE id= OBJECT_ID(N'[W_TradeSettings]') AND type in (N'U'))
DROP TABLE [W_TradeSettings]
BEGIN
CREATE TABLE [W_TradeSettings] (
[ID] [int]  IDENTITY (1, 1)  NOT NULL,
[TradeType] [nvarchar]  (100) NOT NULL,
[isADD] [bit]  NULL DEFAULT (0),
[isEdit] [bit]  NULL DEFAULT (0),
[Mark] [int]  NULL DEFAULT (0),
[isEmail] [bit]  NULL DEFAULT (0),
[EmailTitle] [nvarchar]  (100) NULL,
[EmailInfo] [ntext]  NULL,
[isSMS] [bit]  NULL,
[SMSTitle] [nvarchar]  (100) NULL,
[SMSInfo] [nvarchar]  (1000) NULL
 CONSTRAINT [PK_W_TradeSettings] PRIMARY KEY CLUSTERED 
(
	[ID] ASC
) ON [PRIMARY]
) ON [PRIMARY]
END

--38. 愿做代理
IF EXISTS (SELECT * FROM sysobjects WHERE id= OBJECT_ID(N'[W_WillAgent]') AND type in (N'U'))
DROP TABLE [W_WillAgent]
BEGIN
CREATE TABLE [W_WillAgent] (
[ID] [int]  IDENTITY (1, 1)  NOT NULL,
[UserID] [int]  NULL,
[Name] [nvarchar]  (100) NULL,
[AgentType] [int]  NULL,
[Title] [nvarchar]  (100) NULL,
[Validity] [nvarchar]  (100) NULL,
[Count] [int]  NULL,
[Investment] [nvarchar]  (100) NULL,
[Price] [nvarchar]  (100) NULL,
[Standard] [nvarchar]  (100) NULL,
[Detail] [ntext]  NULL,
[Picture] [nvarchar]  (200) NULL,
[Verify] [smallint]  NULL,
[Recommend] [bit]  NULL,
[AddDate] [datetime]  NULL DEFAULT (getdate()),
[Obligate] [nvarchar]  (100) NULL
 CONSTRAINT [PK_W_WillAgent] PRIMARY KEY CLUSTERED 
(
	[ID] ASC
) ON [PRIMARY]
) ON [PRIMARY]
END

--39.展会资讯
IF EXISTS (SELECT * FROM sysobjects WHERE id= OBJECT_ID(N'[W_ExpoNews]') AND type in (N'U'))
DROP TABLE [W_ExpoNews]
BEGIN
CREATE TABLE [W_ExpoNews] (
[id] [int]  IDENTITY (1, 1)  NOT NULL,
[TypeID] [int]  NULL,
[Title] [nvarchar]  (100) NULL,
[Attribute] [nvarchar]  (100) NULL,
[Origin] [nvarchar]  (100) NULL,
[Detail] [ntext]  NULL,
[Picture] [nvarchar]  (200) NULL,
[Verify] [int]  NULL DEFAULT (3),
[AddDate] [datetime]  NULL DEFAULT (getdate())
 CONSTRAINT [PK_W_ExpoNews_1] PRIMARY KEY CLUSTERED 
(
	[id] ASC
) ON [PRIMARY]
) ON [PRIMARY]
END

--40.帮助中心
IF EXISTS (SELECT * FROM sysobjects WHERE id= OBJECT_ID(N'[W_HelpCenter]') AND type in (N'U'))
DROP TABLE [W_HelpCenter]
BEGIN
CREATE TABLE [W_HelpCenter](
	[ID] [int] IDENTITY(1,1) NOT NULL,
	[TypeID] [int] NULL,
	[Title] [nvarchar](200) COLLATE Chinese_PRC_CI_AS NULL,
	[Info] [nvarchar](3000) COLLATE Chinese_PRC_CI_AS NULL,
	[AddDate] [datetime] NULL CONSTRAINT [DF_W_HelpCenter_AddDate]  DEFAULT (getdate()),
 CONSTRAINT [PK_W_HelpCenter] PRIMARY KEY CLUSTERED 
(
	[ID] ASC
) ON [PRIMARY]
) ON [PRIMARY]
END

--41.帮主类别
IF EXISTS (SELECT * FROM sysobjects WHERE id= OBJECT_ID(N'[W_HelpType]') AND type in (N'U'))
DROP TABLE [W_HelpType]
BEGIN
CREATE TABLE [W_HelpType] (
[ID] [int]  IDENTITY (1, 1)  NOT NULL,
[Name] [nvarchar]  (100) NULL,
[ParentID] [int]  NULL
 CONSTRAINT [PK_W_HelpType] PRIMARY KEY CLUSTERED 
(
	[ID] ASC
) ON [PRIMARY]
) ON [PRIMARY]
END

--42.诚招代理
IF EXISTS (SELECT * FROM sysobjects WHERE id= OBJECT_ID(N'[W_SincereAgent]') AND type in (N'U'))
DROP TABLE [W_SincereAgent]
BEGIN
CREATE TABLE [W_SincereAgent] (
[ID] [int]  IDENTITY (1, 1)  NOT NULL,
[UserID] [int]  NULL,
[Name] [nvarchar]  (100) NULL,
[AgentType] [int]  NULL,
[Title] [nvarchar]  (100) NULL,
[Validity] [nvarchar]  (40) NULL,
[Brand] [nvarchar]  (100) NULL,
[Investment] [nvarchar]  (100) NULL,
[Amount] [float]  NULL,
[InitialFee] [float]  NULL,
[Require] [nvarchar]  (100) NULL,
[Cradle] [nvarchar]  (100) NULL,
[Payback] [float]  NULL,
[Period] [float]  NULL,
[Concession] [float]  NULL,
[Contract] [float]  NULL,
[Count] [int]  NULL,
[BusinessDate] [int]  NULL,
[isMoreBrand] [bit]  NULL,
[BusinessMode] [nvarchar]  (100) NULL,
[Developmental] [nvarchar]  (100) NULL,
[Detail] [ntext]  NULL,
[Picture] [nvarchar]  (200) NULL,
[Verify] [smallint]  NULL,
[Recommend] [bit]  NULL,
[AddDate] [datetime]  NULL DEFAULT (getdate()),
[Obligate] [nvarchar]  (100) NULL
 CONSTRAINT [PK_W_SincereAgent] PRIMARY KEY CLUSTERED 
(
	[ID] ASC
) ON [PRIMARY]
) ON [PRIMARY]
END

--43.资讯类型
IF EXISTS (SELECT * FROM sysobjects WHERE id= OBJECT_ID(N'[W_ConsultativeType]') AND type in (N'U'))
DROP TABLE [W_ConsultativeType]
BEGIN
CREATE TABLE [W_ConsultativeType] (
[ID] [int]  IDENTITY (1, 1)  NOT NULL,
[Name] [nvarchar]  (100) NOT NULL,
[ParentID] [int]  NOT NULL,
[FullID] [varchar]  (50) NULL
 CONSTRAINT [PK_W_ConsultativeType] PRIMARY KEY CLUSTERED 
(
	[ID] ASC
) ON [PRIMARY]
) ON [PRIMARY]
END

--44.用户自定义标签
IF EXISTS (SELECT * FROM sysobjects WHERE id= OBJECT_ID(N'[W_UserLable]') AND type in (N'U'))
DROP TABLE [W_UserLable]
BEGIN
CREATE TABLE [W_UserLable] (
[ID] [int]  IDENTITY (1, 1)  NOT NULL,
[TypeID] [int]  NULL,
[LableName] [nvarchar]  (40) NOT NULL,
[Info] [ntext]  NOT NULL,
[AddDate] [datetime]  NOT NULL DEFAULT (getdate()),
[Remarks] [nvarchar]  (200) NULL
 CONSTRAINT [PK_W_UserLable] PRIMARY KEY CLUSTERED 
(
	[ID] ASC
) ON [PRIMARY]
) ON [PRIMARY]
END

--45.模板类别
IF EXISTS (SELECT * FROM sysobjects WHERE id= OBJECT_ID(N'[W_TemplatesType]') AND type in (N'U'))
DROP TABLE [W_TemplatesType] 
BEGIN
CREATE TABLE [W_TemplatesType] (
[ID] [int]  IDENTITY (1, 1)  NOT NULL,
[Name] [nvarchar]  (40) NULL,
[URL] [int]  NULL,
[ADDDate] [datetime]  NULL,
[ParentID] [int]  NULL,
[FullID] [varchar]  (50) NULL	
 CONSTRAINT [PK_W_TemplatesType] PRIMARY KEY CLUSTERED 
(
	[ID] ASC
) ON [PRIMARY]
) ON [PRIMARY]
END

--46.友情链接
IF EXISTS (SELECT * FROM sysobjects WHERE id= OBJECT_ID(N'[W_Links]') AND type in (N'U'))
DROP TABLE [W_Links]
BEGIN
CREATE TABLE [W_Links] (
[ID] [int]  IDENTITY (1, 1)  NOT NULL,
[LinkType] [int]  NULL,
[WebName] [nvarchar]  (100) NULL,
[WebURL] [nvarchar]  (100) NULL,
[WebLOGO] [varchar]  (50) NULL,
[WebIntro] [nvarchar]  (600) NULL,
[WebAdmin] [nvarchar]  (20) NULL,
[Email] [varchar]  (50) NULL,
[Verify] [bit]  NULL,
[Sequence] [varchar]  (10) NULL,
[AddDate] [datetime]  NULL DEFAULT (getdate())
 CONSTRAINT [PK_W_Links] PRIMARY KEY CLUSTERED 
(
	[ID] ASC
) ON [PRIMARY]
) ON [PRIMARY]
END

--47.热门关键词
IF EXISTS (SELECT * FROM sysobjects WHERE id= OBJECT_ID(N'[W_Keyword]') AND type in (N'U'))
DROP TABLE [W_Keyword]
BEGIN
CREATE TABLE [W_Keyword] (
[ID] [int]  IDENTITY (1, 1)  NOT NULL,
[Name] [nvarchar]  (100) NOT NULL,
[Type] [nvarchar]  (100) NOT NULL,
[Count] [int]  NOT NULL DEFAULT (0),
[IsCommend] [bit]  NOT NULL DEFAULT (0),
[IsStatic] [bit]  NOT NULL DEFAULT (0),
[EditDate] [datetime]  NOT NULL DEFAULT (getdate())
 CONSTRAINT [PK_W_Keyword] PRIMARY KEY CLUSTERED 
(
	[ID] ASC
) ON [PRIMARY]
) ON [PRIMARY]
END

--48. 网站Meta(优化)类别
IF EXISTS (SELECT * FROM sysobjects WHERE id= OBJECT_ID(N'[W_MetaType]') AND type in (N'U'))
DROP TABLE [W_MetaType]
BEGIN
CREATE TABLE [W_MetaType] (
[ID] [int]  IDENTITY (1, 1)  NOT NULL,
[Type] [nvarchar]  (40) NULL
 CONSTRAINT [PK_W_MetaType] PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)ON [PRIMARY]
) ON [PRIMARY]
END

--49. 用户标签类型
IF EXISTS (SELECT * FROM sysobjects WHERE id= OBJECT_ID(N'[W_UserLableType]') AND type in (N'U'))
DROP TABLE [W_UserLableType]
BEGIN
CREATE TABLE [W_UserLableType](
	[ID] [int] IDENTITY(1,1) NOT NULL,
	[Name] [nvarchar](20) NOT NULL,
 CONSTRAINT [PK_W_UserLableType] PRIMARY KEY CLUSTERED 
(
	[ID] ASC
) ON [PRIMARY]
) ON [PRIMARY]
END

--50.行业分类
IF EXISTS (SELECT * FROM sysobjects WHERE id= OBJECT_ID(N'[W_IndustryType]') AND type in (N'U'))
DROP TABLE [W_IndustryType]
BEGIN
CREATE TABLE [W_IndustryType] (
[ID] [int]  IDENTITY (1, 1)  NOT NULL,
[Type] [varchar]  (20) NOT NULL,
[ToRelease] [bit]  NULL,
[SuperiorsFlag] [smallint]  NULL,
[UnderlingFlag] [smallint]  NULL,
[SuperiorsID] [int]  NULL,
[Superiors] [nvarchar]  (100) NULL,
[Sequence] [smallint]  NULL
 CONSTRAINT [PK_W_IndustryType] PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)ON [PRIMARY]
) ON [PRIMARY]
END

--51.展会信息
IF EXISTS (SELECT * FROM sysobjects WHERE id= OBJECT_ID(N'[W_Expo]') AND type in (N'U'))
DROP TABLE [W_Expo]
BEGIN
CREATE TABLE [W_Expo](
	[ID] [int] IDENTITY(1,1) NOT NULL,
	[UserID] [int] NULL,
	[TypeID] [int] NULL,
	[Title] [nvarchar](100) COLLATE Chinese_PRC_CI_AS NULL,
	[ExpoType] [nvarchar](20) COLLATE Chinese_PRC_CI_AS NULL,
	[StartDate] [datetime] NULL,
	[EndDate] [datetime] NULL,
	[Place] [nvarchar](500) COLLATE Chinese_PRC_CI_AS NULL,
	[Authorize] [nvarchar](500) COLLATE Chinese_PRC_CI_AS NULL,
	[FrontFor] [nvarchar](500) COLLATE Chinese_PRC_CI_AS NULL,
	[Undertake] [nvarchar](500) COLLATE Chinese_PRC_CI_AS NULL,
	[Aidance] [nvarchar](500) COLLATE Chinese_PRC_CI_AS NULL,
	[Summary] [ntext] COLLATE Chinese_PRC_CI_AS NULL,
	[Range] [nvarchar](1000) COLLATE Chinese_PRC_CI_AS NULL,
	[Period] [nvarchar](20) COLLATE Chinese_PRC_CI_AS NULL,
	[Homepage] [nvarchar](100) COLLATE Chinese_PRC_CI_AS NULL,
	[Picture] [nvarchar](100) COLLATE Chinese_PRC_CI_AS NULL,
	[ShowArea] [int] NULL,
	[Businessmen] [int] NULL,
	[Spectator] [int] NULL,
	[Price] [int] NULL,
	[MinNum] [int] NULL,
	[Verify] [int] NULL,
	[AddDate] [datetime] NULL CONSTRAINT [DF_W_Expo_AddDate]  DEFAULT (getdate()),
 CONSTRAINT [PK_W_Expo] PRIMARY KEY CLUSTERED 
(
	[ID] ASC
) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
END

--52.系统标签类型
IF EXISTS (SELECT * FROM sysobjects WHERE id= OBJECT_ID(N'[W_SystemLableType]') AND type in (N'U'))
DROP TABLE [W_SystemLableType]
BEGIN
CREATE TABLE [W_SystemLableType] (
[ID] [int]  IDENTITY (1, 1)  NOT NULL,
[Name] [nvarchar]  (40) NULL,
[ParentID] [int]  NULL
 CONSTRAINT [PK_W_SystemLableType] PRIMARY KEY CLUSTERED 
(
	[ID] ASC
) ON [PRIMARY]
) ON [PRIMARY]
END

--53.网站管理员
IF EXISTS (SELECT * FROM sysobjects WHERE id= OBJECT_ID(N'[W_Manager]') AND type in (N'U'))
DROP TABLE [W_Manager]
BEGIN
CREATE TABLE [W_Manager] (
[ID] [int]  IDENTITY (1, 1)  NOT NULL,
[ManagerName] [nvarchar]  (100) NOT NULL,
[PassWord] [varchar]  (50) NOT NULL,
[RoleID] [int]  NOT NULL,
[Lockedup] [bit]  NOT NULL,
[LastIP] [varchar]  (50) NULL,
[LastDate] [datetime]  NULL,
[AddDate] [datetime]  NULL DEFAULT (getdate())
 CONSTRAINT [PK_W_Manager] PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)ON [PRIMARY]
) ON [PRIMARY]
END

--54. 资讯信息
IF EXISTS (SELECT * FROM sysobjects WHERE id= OBJECT_ID(N'[W_Consultative]') AND type in (N'U'))
DROP TABLE [W_Consultative]
BEGIN
CREATE TABLE [W_Consultative] (
[ID] [int]  IDENTITY (1, 1)  NOT NULL,
[Title] [nvarchar]  (200) NOT NULL DEFAULT (''),
[Color] [varchar]  (50) NULL,
[Font] [varchar]  (50) NULL,
[TypeID] [int]  NOT NULL,
[Picture] [nvarchar]  (200) NULL DEFAULT (''),
[KeyWord] [nvarchar]  (40) NULL,
[Author] [nvarchar]  (40) NULL,
[Origin] [nvarchar]  (100) NOT NULL DEFAULT (''),
[Reading] [nvarchar]  (800) NULL,
[ChangeDirectionLink] [nvarchar]  (100) NULL DEFAULT (''),
[AddDate] [datetime]  NOT NULL DEFAULT (getdate()),
[ClickCount] [varchar]  (10) NULL,
[Detail] [ntext]  NULL DEFAULT (''),
[CountUp] [int]  NULL DEFAULT (0),
[CountDown] [int]  NULL DEFAULT (0),
[IsComment] [bit]  NULL DEFAULT (0),
[IsTop] [bit]  NULL DEFAULT (0),
[IsHotspot] [bit]  NULL DEFAULT (0),
[IsRecommend] [bit]  NULL DEFAULT (0),
[UserID] [varchar]  (500) NULL
 CONSTRAINT [PK_W_Consultative] PRIMARY KEY CLUSTERED 
(
	[ID] ASC
) ON [PRIMARY]
) ON [PRIMARY]
END


--55.咨询留言信息
IF EXISTS (SELECT * FROM sysobjects WHERE id= OBJECT_ID(N'[W_ConsultativeRestore]') AND type in (N'U'))
DROP TABLE [W_ConsultativeRestore]
BEGIN
CREATE TABLE [W_ConsultativeRestore] (
[ID] [int]  IDENTITY (1, 1)  NOT NULL,
[ConsultativeID] [int]  NOT NULL,
[UserName] [nvarchar]  (100) NULL DEFAULT (''),
[AddDate] [datetime]  NULL DEFAULT (getdate()),
[Detail] [ntext]  NULL DEFAULT (''),
[Shield] [bit]  NULL DEFAULT (0)
 CONSTRAINT [PK_W_ ConsultativeRestore] PRIMARY KEY CLUSTERED 
(
	[ID] ASC
) ON [PRIMARY]
) ON [PRIMARY]
END

--56.系统标签类型
IF EXISTS (SELECT * FROM sysobjects WHERE id= OBJECT_ID(N'[W_SystemLable]') AND type in (N'U'))
DROP TABLE [W_SystemLable]
BEGIN
CREATE TABLE [W_SystemLable](
	[ID] [int] IDENTITY(1,1) NOT NULL,
	[Name] [nvarchar](50) COLLATE Chinese_PRC_CI_AS NOT NULL,
	[TypeID] [int] NOT NULL,
	[Title] [nvarchar](50) COLLATE Chinese_PRC_CI_AS NULL,
	[Info] [ntext] COLLATE Chinese_PRC_CI_AS NULL,
	[Remarks] [nvarchar](100) COLLATE Chinese_PRC_CI_AS NULL,
	[Head] [nvarchar](1000) COLLATE Chinese_PRC_CI_AS NULL,
	[Content] [ntext] COLLATE Chinese_PRC_CI_AS NULL,
	[Footer] [nvarchar](1000) COLLATE Chinese_PRC_CI_AS NULL,
 CONSTRAINT [PK_W_SystemLable] PRIMARY KEY CLUSTERED 
(
	[ID] ASC
) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
END

--57.订阅邮箱号
IF EXISTS (SELECT * FROM sysobjects WHERE id= OBJECT_ID(N'[U_SubscriptionEmail]') AND type in (N'U'))
DROP TABLE [U_SubscriptionEmail]
BEGIN
CREATE TABLE [U_SubscriptionEmail](
	[ID] [int] IDENTITY(1,1) NOT NULL,
	[UserID] [int] NULL,
	[Email] [nvarchar](100) COLLATE Chinese_PRC_CI_AS NULL,
	[AddDate] [datetime] NULL CONSTRAINT [DF_U_SubscriptionEmail_AddDate]  DEFAULT (getdate()),
 CONSTRAINT [PK_U_SubscriptionEmail] PRIMARY KEY CLUSTERED 
(
	[ID] ASC
) ON [PRIMARY]
) ON [PRIMARY]
END

--58.订阅供求商机
IF EXISTS (SELECT * FROM sysobjects WHERE id= OBJECT_ID(N'[U_SubscriptionProduct]') AND type in (N'U'))
DROP TABLE [U_SubscriptionProduct]
BEGIN
CREATE TABLE [U_SubscriptionProduct](
	[ID] [int] IDENTITY(1,1) NOT NULL,
	[UserID] [int] NULL,
	[Type] [nvarchar](50) COLLATE Chinese_PRC_CI_AS NULL,
	[Keyword] [nvarchar](50) COLLATE Chinese_PRC_CI_AS NULL,
	[IndType] [nvarchar](50) COLLATE Chinese_PRC_CI_AS NULL,
	[Area] [nvarchar](50) COLLATE Chinese_PRC_CI_AS NULL,
	[AddDate] [datetime] NULL CONSTRAINT [DF_U_SubscriptionProduct_AddDate]  DEFAULT (getdate()),
	[validity] [int] NULL,
 CONSTRAINT [PK_U_Subscription_Product] PRIMARY KEY CLUSTERED 
(
	[ID] ASC
) ON [PRIMARY]
) ON [PRIMARY]
END

--59.订阅商业资讯
IF EXISTS (SELECT * FROM sysobjects WHERE id= OBJECT_ID(N'[U_SubscriptionNews]') AND type in (N'U'))
DROP TABLE [U_SubscriptionNews]
BEGIN
CREATE TABLE [U_SubscriptionNews](
	[ID] [int] IDENTITY(1,1) NOT NULL,
	[UserID] [int] NULL,
	[Type] [nvarchar](50) COLLATE Chinese_PRC_CI_AS NULL,
	[AddDate] [datetime] NULL CONSTRAINT [DF_U_SubscriptionNews_AddDate]  DEFAULT (getdate()),
 CONSTRAINT [PK_U_SubscriptionNews] PRIMARY KEY CLUSTERED 
(
	[ID] ASC
) ON [PRIMARY]
) ON [PRIMARY]
END


--60.邮件统计
IF EXISTS (SELECT * FROM sysobjects WHERE id= OBJECT_ID(N'[W_EmailStatistics]') AND type in (N'U'))
DROP TABLE [W_EmailStatistics]
BEGIN
CREATE TABLE [W_EmailStatistics](
	[Id] [int] IDENTITY(1,1) NOT NULL,
	[UserId] [int] NULL,
	[State] [nvarchar](50) COLLATE Chinese_PRC_CI_AS NULL,
	[SubscriptionType] [nvarchar](50) COLLATE Chinese_PRC_CI_AS NULL,
	[AddDate] [datetime] NULL CONSTRAINT [DF_W_EmailStatistics_AddDate]  DEFAULT (getdate()),
	[Extend] [nvarchar](50) COLLATE Chinese_PRC_CI_AS NULL,
 CONSTRAINT [PK_W_EmailStatistics] PRIMARY KEY CLUSTERED 
(
	[Id] ASC
) ON [PRIMARY]
) ON [PRIMARY]
END


--61.用户产品关系表
IF EXISTS (SELECT * FROM sysobjects WHERE id= OBJECT_ID(N'[W_UsersProducts]') AND type in (N'U'))
DROP TABLE [W_UsersProducts]
BEGIN
CREATE TABLE [W_UsersProducts](
	[ID] [int] IDENTITY(1,1) NOT NULL,
	[UserID] [int] NOT NULL,
	[ProductID] [int] NOT NULL,
	[Verify] [bit] NOT NULL CONSTRAINT [DF_W_UsersProducts_Verify]  DEFAULT (0),
	[Sort] [int] NULL,
	[AddDate] [datetime] NULL CONSTRAINT [DF_W_UsersProducts_AddDate]  DEFAULT (getdate()),
	[Ask] [varchar](100) COLLATE Chinese_PRC_CI_AS NULL,
	[IsTop] [bit] NULL CONSTRAINT [DF_W_UsersProducts_IsTop]  DEFAULT (0),
	[LastDate] [datetime] NULL,
	[Money] [float] NULL CONSTRAINT [DF_W_UsersProducts_Money]  DEFAULT (0),
 CONSTRAINT [PK_W_UsersProducts] PRIMARY KEY CLUSTERED 
(
	[ID] ASC
) ON [PRIMARY]
) ON [PRIMARY]
END


--62. 游客表
IF EXISTS (SELECT * FROM sysobjects WHERE id= OBJECT_ID(N'[U_Visitor]') AND type in (N'U'))
DROP TABLE [U_Visitor]
BEGIN
CREATE TABLE [U_Visitor](
	[ID] [int] IDENTITY(1,1) NOT NULL,
	[LinkMan] [nvarchar](50) COLLATE Chinese_PRC_CI_AS NOT NULL,
	[CompanyName] [nvarchar](200) COLLATE Chinese_PRC_CI_AS NOT NULL,
	[Email] [nvarchar](100) COLLATE Chinese_PRC_CI_AS NOT NULL,
	[Telephone] [nvarchar](30) COLLATE Chinese_PRC_CI_AS NOT NULL,
	[Mobile] [nvarchar](15) COLLATE Chinese_PRC_CI_AS NOT NULL,
	[UserIP] [nvarchar](50) COLLATE Chinese_PRC_CI_AS NOT NULL,
	[AddDate] [datetime] NOT NULL CONSTRAINT [DF_U_Visitor_AddDate]  DEFAULT (getdate())
) ON [PRIMARY]
END

--63.邮件模板
IF EXISTS (SELECT * FROM sysobjects WHERE id= OBJECT_ID(N'[W_EmailTemplate]') AND type in (N'U'))
DROP TABLE [W_EmailTemplate]
BEGIN
CREATE TABLE [W_EmailTemplate](
	[ID] [int] IDENTITY(1,1) NOT NULL,
	[Flag] [nvarchar](50) COLLATE Chinese_PRC_CI_AS NULL,
	[Type] [nvarchar](50) COLLATE Chinese_PRC_CI_AS NULL,
	[isHtml] [bit] NULL,
	[Name] [nvarchar](100) COLLATE Chinese_PRC_CI_AS NULL,
	[Title] [nvarchar](100) COLLATE Chinese_PRC_CI_AS NULL,
	[Content] [text] COLLATE Chinese_PRC_CI_AS NULL,
	[AddDate] [datetime] NULL,
 CONSTRAINT [PK_W_EmailStencil] PRIMARY KEY CLUSTERED 
(
	[ID] ASC
) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
END


--64.游客留言信息
IF EXISTS (SELECT * FROM sysobjects WHERE id= OBJECT_ID(N'[W_VisitorRequest]') AND type in (N'U'))
DROP TABLE [W_VisitorRequest]
BEGIN
CREATE TABLE [W_VisitorRequest](
	[ID] [int] IDENTITY(1,1) NOT NULL,
	[ProductId] [int] NOT NULL,
	[UserName] [nvarchar](50) COLLATE Chinese_PRC_CI_AS NOT NULL,
	[Phone] [nvarchar](50) COLLATE Chinese_PRC_CI_AS NOT NULL,
	[Fax] [nvarchar](50) COLLATE Chinese_PRC_CI_AS NULL,
	[CompanyName] [nvarchar](50) COLLATE Chinese_PRC_CI_AS NULL,
	[Email] [nvarchar](50) COLLATE Chinese_PRC_CI_AS NULL,
	[RequestContent] [nvarchar](100) COLLATE Chinese_PRC_CI_AS NOT NULL,
	[AddDate] [datetime] NOT NULL CONSTRAINT [DF_W_VisitorRequest_AddDate]  DEFAULT (getdate()),
 CONSTRAINT [PK_W_VisitorRequest] PRIMARY KEY CLUSTERED 
(
	[ID] ASC
) ON [PRIMARY]
) ON [PRIMARY]
END

--65.产品表
IF EXISTS (SELECT * FROM sysobjects WHERE id= OBJECT_ID(N'[W_Products]') AND type in (N'U'))
DROP TABLE [W_Products]
BEGIN
CREATE TABLE [W_Products](
	[ID] [int] IDENTITY(1,1) NOT NULL,
	[Name] [varchar](50) COLLATE Chinese_PRC_CI_AS NOT NULL,
	[TypeID] [varchar](50) COLLATE Chinese_PRC_CI_AS NULL,
	[KeyWord] [nvarchar](40) COLLATE Chinese_PRC_CI_AS NULL,
	[Picture] [nvarchar](100) COLLATE Chinese_PRC_CI_AS NULL,
	[Detail] [TEXT] COLLATE Chinese_PRC_CI_AS NULL,
	[AddDate] [datetime] NULL CONSTRAINT [DF_W_Products_AddDate]  DEFAULT (getdate()),
	[Price] [float] NULL CONSTRAINT [DF_W_Products_Time]  DEFAULT (0.00),
 CONSTRAINT [PK_W_Products] PRIMARY KEY CLUSTERED 
(
	[ID] ASC
) ON [PRIMARY]
) ON [PRIMARY]
END
