if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_Admin_Function_Admin_Module]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[Admin_Function] DROP CONSTRAINT FK_Admin_Function_Admin_Module
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_Admin_Item_Admin_Role]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[Admin_Item] DROP CONSTRAINT FK_Admin_Item_Admin_Role
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_Content_Item_Content_Category]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[Content_Item] DROP CONSTRAINT FK_Content_Item_Content_Category
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_Distribute_Area_Distribute_Item]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[Distribute_Area] DROP CONSTRAINT FK_Distribute_Area_Distribute_Item
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_Member_AmountNote_Member_Item]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[Member_AmountNote] DROP CONSTRAINT FK_Member_AmountNote_Member_Item
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_Member_BoughtList_Member_Item]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[Member_BoughtList] DROP CONSTRAINT FK_Member_BoughtList_Member_Item
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_Member_Cash_Member_Item]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[Member_Cash] DROP CONSTRAINT FK_Member_Cash_Member_Item
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_Member_Complaint_Member_Item]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[Member_Complaint] DROP CONSTRAINT FK_Member_Complaint_Member_Item
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_Member_Consignee_Member_Item]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[Member_Consignee] DROP CONSTRAINT FK_Member_Consignee_Member_Item
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_Member_Coupon_Member_Item]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[Member_Coupon] DROP CONSTRAINT FK_Member_Coupon_Member_Item
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_Member_Favorite_Member_Item]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[Member_Favorite] DROP CONSTRAINT FK_Member_Favorite_Member_Item
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_Member_Info_Member_Item]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[Member_Info] DROP CONSTRAINT FK_Member_Info_Member_Item
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_Member_Message_Member_Item]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[Member_Message] DROP CONSTRAINT FK_Member_Message_Member_Item
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_Member_Order_Member_Item]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[Member_Order] DROP CONSTRAINT FK_Member_Order_Member_Item
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_Member_PointNote_Member_Item]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[Member_PointNote] DROP CONSTRAINT FK_Member_PointNote_Member_Item
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_Product_Ask_Member_Item]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[Product_Ask] DROP CONSTRAINT FK_Product_Ask_Member_Item
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_Product_OOS_Member_Item]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[Product_OOS] DROP CONSTRAINT FK_Product_OOS_Member_Item
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_Product_Review_Member_Item]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[Product_Review] DROP CONSTRAINT FK_Product_Review_Member_Item
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_Member_Item_Member_Level]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[Member_Item] DROP CONSTRAINT FK_Member_Item_Member_Level
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_Product_MemberPrice_Member_Level]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[Product_MemberPrice] DROP CONSTRAINT FK_Product_MemberPrice_Member_Level
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_Member_BoughtList_Order_Item]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[Member_BoughtList] DROP CONSTRAINT FK_Member_BoughtList_Order_Item
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_Member_Order_Order_Item]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[Member_Order] DROP CONSTRAINT FK_Member_Order_Order_Item
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_Order_Product_Order_Item]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[Order_Product] DROP CONSTRAINT FK_Order_Product_Order_Item
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_Order_State_Order_Item]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[Order_State] DROP CONSTRAINT FK_Order_State_Order_Item
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_Product_Category_Filter_Product_Category]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[Product_Category_Filter] DROP CONSTRAINT FK_Product_Category_Filter_Product_Category
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_Product_Category_Hot_Product_Category]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[Product_Category_Hot] DROP CONSTRAINT FK_Product_Category_Hot_Product_Category
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_Product_Item_Product_Category]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[Product_Item] DROP CONSTRAINT FK_Product_Item_Product_Category
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_Product_Category_Filter_Value_Product_Category_Filter]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[Product_Category_Filter_Value] DROP CONSTRAINT FK_Product_Category_Filter_Value_Product_Category_Filter
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_Member_BoughtList_Product_Item]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[Member_BoughtList] DROP CONSTRAINT FK_Member_BoughtList_Product_Item
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_Member_Favorite_Product_Item]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[Member_Favorite] DROP CONSTRAINT FK_Member_Favorite_Product_Item
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_Product_Ask_Product_Item]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[Product_Ask] DROP CONSTRAINT FK_Product_Ask_Product_Item
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_Product_Assemble_Product_Item]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[Product_Assemble] DROP CONSTRAINT FK_Product_Assemble_Product_Item
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_Product_Filter_Product_Item]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[Product_Filter] DROP CONSTRAINT FK_Product_Filter_Product_Item
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_Product_Image_Product_Item]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[Product_Image] DROP CONSTRAINT FK_Product_Image_Product_Item
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_Product_MemberPrice_Product_Item]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[Product_MemberPrice] DROP CONSTRAINT FK_Product_MemberPrice_Product_Item
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_Product_MultiImage_Product_Item]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[Product_MultiImage] DROP CONSTRAINT FK_Product_MultiImage_Product_Item
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_Product_Parameter_Product_Item]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[Product_Parameter] DROP CONSTRAINT FK_Product_Parameter_Product_Item
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_Product_Privilege_Product_Item]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[Product_Privilege] DROP CONSTRAINT FK_Product_Privilege_Product_Item
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_Product_Related_Product_Item]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[Product_Related] DROP CONSTRAINT FK_Product_Related_Product_Item
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_Product_Review_Product_Item]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[Product_Review] DROP CONSTRAINT FK_Product_Review_Product_Item
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_Product_Specification_Product_Item]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[Product_Specification] DROP CONSTRAINT FK_Product_Specification_Product_Item
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_Product_SpecificationItem_Product_Specification]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[Product_SpecificationItem] DROP CONSTRAINT FK_Product_SpecificationItem_Product_Specification
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_Product_SpecificationImage_Product_SpecificationItem]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[Product_SpecificationImage] DROP CONSTRAINT FK_Product_SpecificationImage_Product_SpecificationItem
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK_Member_Coupon_Promotions_Coupon]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[Member_Coupon] DROP CONSTRAINT FK_Member_Coupon_Promotions_Coupon
GO

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

CREATE TABLE [dbo].[Admin_Function] (
	[ID] [int] IDENTITY (1, 1) NOT NULL ,
	[ModuleNo] [int] NOT NULL ,
	[FuncNo] [int] NOT NULL ,
	[FuncName] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[FuncEName] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[Admin_Item] (
	[ID] [int] IDENTITY (1, 1) NOT NULL ,
	[RoleID] [int] NOT NULL ,
	[LoginName] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[Password] [nvarchar] (500) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[IsCreator] [bit] NOT NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[Admin_Module] (
	[ID] [int] IDENTITY (1, 1) NOT NULL ,
	[ModuleName] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[ModuleEName] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[Admin_Note] (
	[ID] [int] IDENTITY (1, 1) NOT NULL ,
	[PageUrl] [nvarchar] (800) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[NoteDate] [datetime] NOT NULL ,
	[AdminName] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[AdminIP] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[Description] [nvarchar] (500) COLLATE Chinese_PRC_CI_AS NOT NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[Admin_Operating] (
	[ID] [int] IDENTITY (1, 1) NOT NULL ,
	[AdminName] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[Operating] [nvarchar] (200) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[OperatingUrl] [nvarchar] (800) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[OperatingIP] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[OperatingDate] [datetime] NOT NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[Admin_Role] (
	[ID] [int] IDENTITY (1, 1) NOT NULL ,
	[RoleName] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[RoleAction] [nvarchar] (2000) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[IsCreator] [bit] NOT NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[Content_Category] (
	[ID] [int] IDENTITY (1, 1) NOT NULL ,
	[CategoryName] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[CategoryOrder] [int] NOT NULL ,
	[IsShow] [bit] NOT NULL ,
	[CategoryUrl] [nvarchar] (800) COLLATE Chinese_PRC_CI_AS NULL ,
	[Remark] [ntext] COLLATE Chinese_PRC_CI_AS NULL 
) ON [PRIMARY] 
GO

CREATE TABLE [dbo].[Content_FriendsLinks] (
	[ID] [int] IDENTITY (1, 1) NOT NULL ,
	[FriendsLinksName] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[FriendsLinksUrl] [ntext] COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[FriendsLinksOrder] [int] NOT NULL ,
	[FriendsLinksImage] [ntext] COLLATE Chinese_PRC_CI_AS NULL ,
	[IsShow] [bit] NOT NULL 
) ON [PRIMARY] 
GO

CREATE TABLE [dbo].[Content_Help] (
	[ID] [int] IDENTITY (1, 1) NOT NULL ,
	[ParentID] [int] NOT NULL ,
	[Title] [nvarchar] (200) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[Body] [ntext] COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[IsShow] [bit] NOT NULL ,
	[SortOrder] [int] NOT NULL ,
	[HelpDate] [datetime] NOT NULL 
) ON [PRIMARY] 
GO

CREATE TABLE [dbo].[Content_Item] (
	[ID] [int] IDENTITY (1, 1) NOT NULL ,
	[CategoryID] [int] NOT NULL ,
	[ContentTitle] [nvarchar] (200) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[ContentBody] [ntext] COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[ContentOrder] [int] NOT NULL ,
	[ContentDate] [datetime] NOT NULL ,
	[IsShow] [bit] NOT NULL ,
	[ContentUrl] [ntext] COLLATE Chinese_PRC_CI_AS NULL 
) ON [PRIMARY] 
GO

CREATE TABLE [dbo].[Distribute_Area] (
	[ID] [int] IDENTITY (1, 1) NOT NULL ,
	[DistributeID] [int] NOT NULL ,
	[Area] [ntext] COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[Expressions] [nvarchar] (500) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[IsDelivery] [bit] NOT NULL 
) ON [PRIMARY] 
GO

CREATE TABLE [dbo].[Distribute_Item] (
	[ID] [int] IDENTITY (1, 1) NOT NULL ,
	[DistributeName] [nvarchar] (200) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[DistributeExpressions] [nvarchar] (500) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[IsProtect] [bit] NOT NULL ,
	[ProtectPercent] [int] NOT NULL ,
	[ProtectPrice] [decimal](19, 2) NOT NULL ,
	[DistributeRemarks] [ntext] COLLATE Chinese_PRC_CI_AS NULL 
) ON [PRIMARY] 
GO

CREATE TABLE [dbo].[Member_AmountNote] (
	[ID] [int] IDENTITY (1, 1) NOT NULL ,
	[MemberID] [int] NOT NULL ,
	[AmountNumber] [decimal](19, 2) NOT NULL ,
	[Remark] [nvarchar] (500) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[OperateDate] [datetime] NOT NULL ,
	[Operate] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[Member_BoughtList] (
	[ID] [int] IDENTITY (1, 1) NOT NULL ,
	[MemberID] [int] NOT NULL ,
	[ProductID] [int] NOT NULL ,
	[OrderNumber] [nvarchar] (400) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[BuyDate] [datetime] NOT NULL ,
	[IsReview] [bit] NOT NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[Member_Cash] (
	[ID] [int] IDENTITY (1, 1) NOT NULL ,
	[MemberID] [int] NOT NULL ,
	[Amount] [decimal](19, 2) NOT NULL ,
	[BankCard] [nvarchar] (300) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[BankCardName] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[BankCardPeople] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[ApplyDate] [datetime] NOT NULL ,
	[CashDate] [datetime] NOT NULL ,
	[State] [bit] NOT NULL ,
	[Remark] [nvarchar] (500) COLLATE Chinese_PRC_CI_AS NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[Member_Complaint] (
	[ID] [int] IDENTITY (1, 1) NOT NULL ,
	[MemberID] [int] NOT NULL ,
	[ComplaintType] [nvarchar] (20) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[ComplaintTitle] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[ComplaintBody] [nvarchar] (500) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[ComplaintReply] [nvarchar] (500) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[ComplaintDate] [datetime] NOT NULL ,
	[State] [bit] NOT NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[Member_Consignee] (
	[ID] [int] IDENTITY (1, 1) NOT NULL ,
	[MemberID] [int] NOT NULL ,
	[Consignee] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[ConsigneePhone] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[ConsigneeMobile] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[ConsigneeEmail] [nvarchar] (250) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[ConsigneeAddress] [ntext] COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[ConsigneeZipCode] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[ConsigneeArea] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL 
) ON [PRIMARY] 
GO

CREATE TABLE [dbo].[Member_Coupon] (
	[ID] [int] IDENTITY (1, 1) NOT NULL ,
	[MemberID] [int] NOT NULL ,
	[CouponID] [int] NOT NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[Member_Favorite] (
	[ID] [int] IDENTITY (1, 1) NOT NULL ,
	[MemberID] [int] NOT NULL ,
	[ProductID] [int] NOT NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[Member_Info] (
	[ID] [int] IDENTITY (1, 1) NOT NULL ,
	[MemberID] [int] NOT NULL ,
	[InfoType] [nvarchar] (20) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[InfoName] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[InfoValue] [nvarchar] (500) COLLATE Chinese_PRC_CI_AS NOT NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[Member_Item] (
	[ID] [int] IDENTITY (1, 1) NOT NULL ,
	[LevelID] [int] NOT NULL ,
	[LoginName] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[LoginPassword] [nvarchar] (100) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[Email] [nvarchar] (200) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[Amount] [decimal](19, 2) NOT NULL ,
	[Point] [int] NOT NULL ,
	[JoinDate] [datetime] NOT NULL ,
	[IsActivation] [bit] NOT NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[Member_Level] (
	[ID] [int] IDENTITY (1, 1) NOT NULL ,
	[LevelName] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[MeetPoint] [int] NOT NULL ,
	[Discount] [float] NOT NULL ,
	[PointMultiple] [float] NOT NULL ,
	[NoDeliveryCosts] [bit] NOT NULL ,
	[Remark] [ntext] COLLATE Chinese_PRC_CI_AS NULL 
) ON [PRIMARY] 
GO

CREATE TABLE [dbo].[Member_Message] (
	[ID] [int] IDENTITY (1, 1) NOT NULL ,
	[MemberID] [int] NOT NULL ,
	[Title] [nvarchar] (200) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[Body] [ntext] COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[IsView] [bit] NOT NULL ,
	[SendDate] [datetime] NOT NULL 
) ON [PRIMARY] 
GO

CREATE TABLE [dbo].[Member_Order] (
	[ID] [int] IDENTITY (1, 1) NOT NULL ,
	[MemberID] [int] NOT NULL ,
	[OrderNumber] [nvarchar] (400) COLLATE Chinese_PRC_CI_AS NOT NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[Member_PointNote] (
	[ID] [int] IDENTITY (1, 1) NOT NULL ,
	[MemberID] [int] NOT NULL ,
	[PointNumber] [int] NOT NULL ,
	[Remark] [nvarchar] (500) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[OperateDate] [datetime] NOT NULL ,
	[Operate] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[Member_RegisterProject] (
	[ID] [int] IDENTITY (1, 1) NOT NULL ,
	[RegisterType] [nvarchar] (20) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[RegisterName] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[IsMust] [bit] NOT NULL ,
	[IsShow] [bit] NOT NULL ,
	[OptionalValue] [nvarchar] (500) COLLATE Chinese_PRC_CI_AS NOT NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[Order_Item] (
	[OrderNumber] [nvarchar] (400) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[OrderType] [bit] NOT NULL ,
	[OrderState] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[OrderPrice] [decimal](19, 2) NOT NULL ,
	[IsPayment] [bit] NOT NULL ,
	[IsSendProduct] [bit] NOT NULL ,
	[IsComplete] [bit] NOT NULL ,
	[PaymentMode] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[CreateDate] [datetime] NOT NULL ,
	[ConsigneeName] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[ConsigneePhone] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[ConsigneeMobile] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[ConsigneeEmail] [nvarchar] (250) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[ConsigneeAddress] [ntext] COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[ConsigneeZipCode] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[DispatchArea] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[DispatchMode] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[DispatchPrice] [decimal](19, 2) NOT NULL ,
	[DeliverDay] [nvarchar] (150) COLLATE Chinese_PRC_CI_AS NULL ,
	[DeliverTime] [nvarchar] (150) COLLATE Chinese_PRC_CI_AS NULL ,
	[InvoiceHead] [nvarchar] (150) COLLATE Chinese_PRC_CI_AS NULL ,
	[LogisticsCompany] [nvarchar] (150) COLLATE Chinese_PRC_CI_AS NULL ,
	[CourierTrackingNumber] [nvarchar] (150) COLLATE Chinese_PRC_CI_AS NULL ,
	[AccountBank] [nvarchar] (150) COLLATE Chinese_PRC_CI_AS NULL ,
	[AccountBankNumber] [nvarchar] (150) COLLATE Chinese_PRC_CI_AS NULL ,
	[Remark] [nvarchar] (500) COLLATE Chinese_PRC_CI_AS NULL 
) ON [PRIMARY] 
GO

CREATE TABLE [dbo].[Order_Product] (
	[ID] [int] IDENTITY (1, 1) NOT NULL ,
	[OrderNumber] [nvarchar] (400) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[BuyNumber] [int] NOT NULL ,
	[ProductName] [nvarchar] (500) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[ProductNumber] [nvarchar] (250) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[ProductPrice] [decimal](19, 2) NOT NULL ,
	[Remark] [ntext] COLLATE Chinese_PRC_CI_AS NULL 
) ON [PRIMARY] 
GO

CREATE TABLE [dbo].[Order_State] (
	[ID] [int] IDENTITY (1, 1) NOT NULL ,
	[OrderNumber] [nvarchar] (400) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[OrderState] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[OrderOperator] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[CreateDate] [datetime] NOT NULL ,
	[Remark] [ntext] COLLATE Chinese_PRC_CI_AS NULL 
) ON [PRIMARY] 
GO

CREATE TABLE [dbo].[Payment_Interface] (
	[ID] [int] IDENTITY (1, 1) NOT NULL ,
	[PaymentTag] [nvarchar] (20) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[PaymentName] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[IsOpen] [bit] NOT NULL ,
	[AccountNumber] [nvarchar] (200) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[AccountKey] [nvarchar] (500) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[AccountSigh] [nvarchar] (500) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[PayRate] [float] NOT NULL ,
	[Description] [ntext] COLLATE Chinese_PRC_CI_AS NULL 
) ON [PRIMARY] 
GO

CREATE TABLE [dbo].[Product_Ask] (
	[ID] [int] IDENTITY (1, 1) NOT NULL ,
	[ProductID] [int] NOT NULL ,
	[MemberID] [int] NOT NULL ,
	[AskType] [nvarchar] (20) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[AskTitle] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[AskBody] [nvarchar] (500) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[AskReply] [nvarchar] (500) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[AskDate] [datetime] NOT NULL ,
	[ReplyDate] [datetime] NOT NULL ,
	[IsShow] [bit] NOT NULL ,
	[State] [bit] NOT NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[Product_Assemble] (
	[ID] [int] IDENTITY (1, 1) NOT NULL ,
	[ProductID] [int] NOT NULL ,
	[ProductNumber] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[AssembleValue] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[Stock] [int] NOT NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[Product_Category] (
	[ID] [int] IDENTITY (1, 1) NOT NULL ,
	[ParentID] [int] NOT NULL ,
	[CategoryName] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[CategoryOrder] [int] NOT NULL ,
	[IsShow] [bit] NOT NULL ,
	[CategoryUrl] [nvarchar] (800) COLLATE Chinese_PRC_CI_AS NULL ,
	[CategoryImage] [nvarchar] (800) COLLATE Chinese_PRC_CI_AS NULL ,
	[CategoryTemplate] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[Remark] [ntext] COLLATE Chinese_PRC_CI_AS NULL 
) ON [PRIMARY] 
GO

CREATE TABLE [dbo].[Product_Category_Filter] (
	[ID] [int] IDENTITY (1, 1) NOT NULL ,
	[CategoryID] [int] NOT NULL ,
	[FilterName] [nvarchar] (30) COLLATE Chinese_PRC_CI_AS NOT NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[Product_Category_Filter_Value] (
	[ID] [int] IDENTITY (1, 1) NOT NULL ,
	[FilterID] [int] NOT NULL ,
	[FilterValue] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[Product_Category_Hot] (
	[ID] [int] IDENTITY (1, 1) NOT NULL ,
	[CategoryID] [int] NOT NULL ,
	[ProductID] [int] NOT NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[Product_Filter] (
	[ID] [int] IDENTITY (1, 1) NOT NULL ,
	[ProductID] [int] NOT NULL ,
	[FilterValueID] [int] NOT NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[Product_Image] (
	[ID] [int] IDENTITY (1, 1) NOT NULL ,
	[ProductID] [int] NOT NULL ,
	[BigImage] [nvarchar] (500) COLLATE Chinese_PRC_CI_AS NULL ,
	[ThumbnailsImage] [nvarchar] (500) COLLATE Chinese_PRC_CI_AS NULL ,
	[SmallImage] [nvarchar] (500) COLLATE Chinese_PRC_CI_AS NULL ,
	[MicroImage] [nvarchar] (500) COLLATE Chinese_PRC_CI_AS NULL ,
	[MediumImage] [nvarchar] (500) COLLATE Chinese_PRC_CI_AS NULL ,
	[ListImage] [nvarchar] (500) COLLATE Chinese_PRC_CI_AS NULL ,
	[OriginalityImage] [nvarchar] (500) COLLATE Chinese_PRC_CI_AS NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[Product_Item] (
	[ID] [int] IDENTITY (1, 1) NOT NULL ,
	[CategoryID] [int] NOT NULL ,
	[OtherCategorys] [nvarchar] (800) COLLATE Chinese_PRC_CI_AS NULL ,
	[ProductLocation] [nvarchar] (500) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[ProductNumber] [nvarchar] (200) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[ProductName] [nvarchar] (200) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[ProductSubtitle] [nvarchar] (300) COLLATE Chinese_PRC_CI_AS NULL ,
	[ProductMeasure] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[ProductPrice] [decimal](19, 2) NOT NULL ,
	[ProductMarketPrice] [decimal](19, 2) NULL ,
	[ProductCostPeice] [decimal](19, 2) NULL ,
	[ProductSummarize] [ntext] COLLATE Chinese_PRC_CI_AS NULL ,
	[ProductContent] [ntext] COLLATE Chinese_PRC_CI_AS NULL ,
	[ProductHeft] [float] NULL ,
	[ProductTag] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[ProductFilter] [nvarchar] (500) COLLATE Chinese_PRC_CI_AS NULL ,
	[ProductStock] [int] NOT NULL ,
	[ProductBrowseNumber] [int] NOT NULL ,
	[ProductSellNumber] [int] NOT NULL ,
	[ProductOrder] [int] NOT NULL ,
	[IsShow] [bit] NOT NULL ,
	[IsSell] [bit] NOT NULL 
) ON [PRIMARY] 
GO

CREATE TABLE [dbo].[Product_MemberPrice] (
	[ID] [int] IDENTITY (1, 1) NOT NULL ,
	[ProductID] [int] NOT NULL ,
	[MemberLevelID] [int] NOT NULL ,
	[Price] [decimal](19, 2) NOT NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[Product_MultiImage] (
	[ID] [int] IDENTITY (1, 1) NOT NULL ,
	[ProductID] [int] NOT NULL ,
	[SmallImage] [nvarchar] (500) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[BigImage] [nvarchar] (500) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[OriginalityImage] [nvarchar] (500) COLLATE Chinese_PRC_CI_AS NOT NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[Product_OOS] (
	[ID] [int] IDENTITY (1, 1) NOT NULL ,
	[MemberID] [int] NOT NULL ,
	[ProductName] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[ProductNumber] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[EMail] [nvarchar] (300) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[NoticeDate] [datetime] NOT NULL ,
	[RegisterDate] [datetime] NOT NULL ,
	[State] [bit] NOT NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[Product_Parameter] (
	[ID] [int] IDENTITY (1, 1) NOT NULL ,
	[ProductID] [int] NOT NULL ,
	[ParameterName] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[ParameterValue] [nvarchar] (500) COLLATE Chinese_PRC_CI_AS NOT NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[Product_Privilege] (
	[ID] [int] IDENTITY (1, 1) NOT NULL ,
	[ProductID] [int] NOT NULL ,
	[IsPoint] [bit] NOT NULL ,
	[Point] [int] NOT NULL ,
	[IsTimeLimit] [bit] NOT NULL ,
	[StartTime] [datetime] NOT NULL ,
	[EndTime] [datetime] NOT NULL ,
	[DiscountPriceToLimit] [decimal](19, 2) NOT NULL ,
	[IsUsePoint] [bit] NOT NULL ,
	[UsePointNumber] [int] NOT NULL ,
	[DiscountPriceToPoint] [decimal](19, 2) NOT NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[Product_Related] (
	[ID] [int] IDENTITY (1, 1) NOT NULL ,
	[ProductID] [int] NOT NULL ,
	[RelatedID] [int] NOT NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[Product_Review] (
	[ID] [int] IDENTITY (1, 1) NOT NULL ,
	[ProductID] [int] NOT NULL ,
	[MemberID] [int] NOT NULL ,
	[ReviewTitle] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[ReviewBody] [nvarchar] (500) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[ReviewScore] [int] NOT NULL ,
	[ReviewDate] [datetime] NOT NULL ,
	[IsShow] [bit] NOT NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[Product_Search] (
	[ID] [int] IDENTITY (1, 1) NOT NULL ,
	[ParentID] [int] NOT NULL ,
	[SearchName] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[SearchOrder] [int] NOT NULL ,
	[SearchImage] [nvarchar] (800) COLLATE Chinese_PRC_CI_AS NULL ,
	[SearchUrl] [ntext] COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[IsShow] [bit] NOT NULL ,
	[Remark] [ntext] COLLATE Chinese_PRC_CI_AS NULL 
) ON [PRIMARY] 
GO

CREATE TABLE [dbo].[Product_Specification] (
	[ID] [int] IDENTITY (1, 1) NOT NULL ,
	[ProductID] [int] NOT NULL ,
	[Specification] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[Product_SpecificationImage] (
	[ID] [int] IDENTITY (1, 1) NOT NULL ,
	[SpecificationItemID] [int] NOT NULL ,
	[Image] [nvarchar] (500) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[SmallImage] [nvarchar] (500) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[OriginalityImage] [nvarchar] (500) COLLATE Chinese_PRC_CI_AS NOT NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[Product_SpecificationItem] (
	[ID] [int] IDENTITY (1, 1) NOT NULL ,
	[SpecificationID] [int] NOT NULL ,
	[SpecificationItem] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[Product_Tag] (
	[ID] [int] IDENTITY (1, 1) NOT NULL ,
	[TagName] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[IsShow] [bit] NOT NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[Promotions_Coupon] (
	[ID] [int] IDENTITY (1, 1) NOT NULL ,
	[CouponName] [nvarchar] (100) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[CouponNumber] [nvarchar] (100) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[Activation] [nvarchar] (100) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[MeetPrice] [decimal](19, 2) NOT NULL ,
	[MortagagePrice] [decimal](19, 2) NOT NULL ,
	[IsFreeFreight] [bit] NOT NULL ,
	[StartDate] [datetime] NOT NULL ,
	[OutDate] [datetime] NOT NULL ,
	[IsBlankOut] [bit] NOT NULL ,
	[IsPutOut] [bit] NOT NULL ,
	[Remak] [ntext] COLLATE Chinese_PRC_CI_AS NULL 
) ON [PRIMARY] 
GO

CREATE TABLE [dbo].[Promotions_GiftCard] (
	[ID] [int] IDENTITY (1, 1) NOT NULL ,
	[CardName] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[CardNumber] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[Activation] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[GiftMemberLevel] [int] NOT NULL ,
	[GiftPoint] [int] NOT NULL ,
	[GiftAmount] [decimal](19, 2) NOT NULL ,
	[IsActivation] [bit] NOT NULL ,
	[IsSend] [bit] NOT NULL ,
	[StartDate] [datetime] NOT NULL ,
	[EffectiveDate] [datetime] NOT NULL ,
	[SendDate] [datetime] NOT NULL ,
	[ActivationDate] [datetime] NOT NULL ,
	[CreateDate] [datetime] NOT NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[Promotions_Priviege] (
	[ID] [int] IDENTITY (1, 1) NOT NULL ,
	[PrivilegeType] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[PrivilegeName] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[StartTime] [datetime] NOT NULL ,
	[EndTime] [datetime] NOT NULL ,
	[MeetPrice] [decimal](19, 2) NOT NULL ,
	[PriceOrDiscount] [float] NOT NULL ,
	[PrivilegeInfo] [nvarchar] (500) COLLATE Chinese_PRC_CI_AS NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[Template_CustomTag] (
	[ID] [int] IDENTITY (1, 1) NOT NULL ,
	[Name] [nvarchar] (100) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[TagName] [nvarchar] (200) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[TagValue] [ntext] COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[Remark] [nvarchar] (500) COLLATE Chinese_PRC_CI_AS NULL 
) ON [PRIMARY] 
GO

ALTER TABLE [dbo].[Admin_Function] WITH NOCHECK ADD 
	CONSTRAINT [PK_Admin_Function] PRIMARY KEY  CLUSTERED 
	(
		[ID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[Admin_Item] WITH NOCHECK ADD 
	CONSTRAINT [PK_Admin_Item] PRIMARY KEY  CLUSTERED 
	(
		[ID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[Admin_Module] WITH NOCHECK ADD 
	CONSTRAINT [PK_Admin_Module] PRIMARY KEY  CLUSTERED 
	(
		[ID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[Admin_Note] WITH NOCHECK ADD 
	CONSTRAINT [PK_Admin_Note] PRIMARY KEY  CLUSTERED 
	(
		[ID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[Admin_Operating] WITH NOCHECK ADD 
	CONSTRAINT [PK_Admin_Operating] PRIMARY KEY  CLUSTERED 
	(
		[ID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[Admin_Role] WITH NOCHECK ADD 
	CONSTRAINT [PK_Admin_Role] PRIMARY KEY  CLUSTERED 
	(
		[ID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[Content_Category] WITH NOCHECK ADD 
	CONSTRAINT [PK_TABLE1] PRIMARY KEY  CLUSTERED 
	(
		[ID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[Content_FriendsLinks] WITH NOCHECK ADD 
	CONSTRAINT [PK_Content_FriendsLinks] PRIMARY KEY  CLUSTERED 
	(
		[ID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[Content_Help] WITH NOCHECK ADD 
	CONSTRAINT [PK_Content_Help] PRIMARY KEY  CLUSTERED 
	(
		[ID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[Content_Item] WITH NOCHECK ADD 
	CONSTRAINT [PK_Content_Item] PRIMARY KEY  CLUSTERED 
	(
		[ID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[Distribute_Area] WITH NOCHECK ADD 
	CONSTRAINT [PK_Distribute_Area] PRIMARY KEY  CLUSTERED 
	(
		[ID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[Distribute_Item] WITH NOCHECK ADD 
	CONSTRAINT [PK_Distribute_Item] PRIMARY KEY  CLUSTERED 
	(
		[ID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[Member_AmountNote] WITH NOCHECK ADD 
	CONSTRAINT [PK_Member_AmountNote] PRIMARY KEY  CLUSTERED 
	(
		[ID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[Member_BoughtList] WITH NOCHECK ADD 
	CONSTRAINT [PK_Member_BoughtList] PRIMARY KEY  CLUSTERED 
	(
		[ID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[Member_Cash] WITH NOCHECK ADD 
	CONSTRAINT [PK_Member_Cash] PRIMARY KEY  CLUSTERED 
	(
		[ID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[Member_Complaint] WITH NOCHECK ADD 
	CONSTRAINT [PK_Member_Complaint] PRIMARY KEY  CLUSTERED 
	(
		[ID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[Member_Consignee] WITH NOCHECK ADD 
	CONSTRAINT [PK_Member_Consignee] PRIMARY KEY  CLUSTERED 
	(
		[ID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[Member_Coupon] WITH NOCHECK ADD 
	CONSTRAINT [PK_Member_Coupon] PRIMARY KEY  CLUSTERED 
	(
		[ID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[Member_Favorite] WITH NOCHECK ADD 
	CONSTRAINT [PK_Member_Favorite] PRIMARY KEY  CLUSTERED 
	(
		[ID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[Member_Info] WITH NOCHECK ADD 
	CONSTRAINT [PK_Member_Info] PRIMARY KEY  CLUSTERED 
	(
		[ID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[Member_Item] WITH NOCHECK ADD 
	CONSTRAINT [PK_Member_Item] PRIMARY KEY  CLUSTERED 
	(
		[ID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[Member_Level] WITH NOCHECK ADD 
	CONSTRAINT [PK_Member_Level] PRIMARY KEY  CLUSTERED 
	(
		[ID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[Member_Message] WITH NOCHECK ADD 
	CONSTRAINT [PK_Member_Message] PRIMARY KEY  CLUSTERED 
	(
		[ID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[Member_Order] WITH NOCHECK ADD 
	CONSTRAINT [PK_Member_Order] PRIMARY KEY  CLUSTERED 
	(
		[ID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[Member_PointNote] WITH NOCHECK ADD 
	CONSTRAINT [PK_Member_PointNote] PRIMARY KEY  CLUSTERED 
	(
		[ID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[Member_RegisterProject] WITH NOCHECK ADD 
	CONSTRAINT [PK_Member_RegisterProject] PRIMARY KEY  CLUSTERED 
	(
		[ID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[Order_Item] WITH NOCHECK ADD 
	CONSTRAINT [PK_Order] PRIMARY KEY  CLUSTERED 
	(
		[OrderNumber]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[Order_Product] WITH NOCHECK ADD 
	CONSTRAINT [PK_Order_Product] PRIMARY KEY  CLUSTERED 
	(
		[ID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[Order_State] WITH NOCHECK ADD 
	CONSTRAINT [PK_Order_State] PRIMARY KEY  CLUSTERED 
	(
		[ID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[Payment_Interface] WITH NOCHECK ADD 
	CONSTRAINT [PK_Payment_Interface] PRIMARY KEY  CLUSTERED 
	(
		[ID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[Product_Ask] WITH NOCHECK ADD 
	CONSTRAINT [PK_Member_Ask] PRIMARY KEY  CLUSTERED 
	(
		[ID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[Product_Assemble] WITH NOCHECK ADD 
	CONSTRAINT [PK_Product_Assemble] PRIMARY KEY  CLUSTERED 
	(
		[ID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[Product_Category] WITH NOCHECK ADD 
	CONSTRAINT [PK_Product_Category] PRIMARY KEY  CLUSTERED 
	(
		[ID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[Product_Category_Filter] WITH NOCHECK ADD 
	CONSTRAINT [PK_Product_Category_Filter] PRIMARY KEY  CLUSTERED 
	(
		[ID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[Product_Category_Filter_Value] WITH NOCHECK ADD 
	CONSTRAINT [PK_Product_Category_Filter_Value] PRIMARY KEY  CLUSTERED 
	(
		[ID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[Product_Category_Hot] WITH NOCHECK ADD 
	CONSTRAINT [PK_Product_Category_Hot] PRIMARY KEY  CLUSTERED 
	(
		[ID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[Product_Filter] WITH NOCHECK ADD 
	CONSTRAINT [PK_Product_Filter] PRIMARY KEY  CLUSTERED 
	(
		[ID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[Product_Image] WITH NOCHECK ADD 
	CONSTRAINT [PK_Product_Image] PRIMARY KEY  CLUSTERED 
	(
		[ID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[Product_Item] WITH NOCHECK ADD 
	CONSTRAINT [PK_Product_Item] PRIMARY KEY  CLUSTERED 
	(
		[ID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[Product_MemberPrice] WITH NOCHECK ADD 
	CONSTRAINT [PK_Product_MemberPrice] PRIMARY KEY  CLUSTERED 
	(
		[ID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[Product_MultiImage] WITH NOCHECK ADD 
	CONSTRAINT [PK_Product_MultiImage] PRIMARY KEY  CLUSTERED 
	(
		[ID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[Product_OOS] WITH NOCHECK ADD 
	CONSTRAINT [PK_Product_OOS] PRIMARY KEY  CLUSTERED 
	(
		[ID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[Product_Parameter] WITH NOCHECK ADD 
	CONSTRAINT [PK_Product_Parameter] PRIMARY KEY  CLUSTERED 
	(
		[ID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[Product_Privilege] WITH NOCHECK ADD 
	CONSTRAINT [PK_Product_Privilege] PRIMARY KEY  CLUSTERED 
	(
		[ID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[Product_Related] WITH NOCHECK ADD 
	CONSTRAINT [PK_Product_Related] PRIMARY KEY  CLUSTERED 
	(
		[ID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[Product_Review] WITH NOCHECK ADD 
	CONSTRAINT [PK_Product_Review] PRIMARY KEY  CLUSTERED 
	(
		[ID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[Product_Search] WITH NOCHECK ADD 
	CONSTRAINT [PK_Product_Search] PRIMARY KEY  CLUSTERED 
	(
		[ID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[Product_Specification] WITH NOCHECK ADD 
	CONSTRAINT [PK_Product_Specification] PRIMARY KEY  CLUSTERED 
	(
		[ID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[Product_SpecificationImage] WITH NOCHECK ADD 
	CONSTRAINT [PK_Product_SpecificationImage] PRIMARY KEY  CLUSTERED 
	(
		[ID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[Product_SpecificationItem] WITH NOCHECK ADD 
	CONSTRAINT [PK_Specification_Item] PRIMARY KEY  CLUSTERED 
	(
		[ID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[Product_Tag] WITH NOCHECK ADD 
	CONSTRAINT [PK_Product_Tag] PRIMARY KEY  CLUSTERED 
	(
		[ID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[Promotions_Coupon] WITH NOCHECK ADD 
	CONSTRAINT [PK_Promotions_Coupon] PRIMARY KEY  CLUSTERED 
	(
		[ID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[Promotions_GiftCard] WITH NOCHECK ADD 
	CONSTRAINT [PK_Promotions_GiftCard] PRIMARY KEY  CLUSTERED 
	(
		[ID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[Promotions_Priviege] WITH NOCHECK ADD 
	CONSTRAINT [PK_Promotions_Priviege] PRIMARY KEY  CLUSTERED 
	(
		[ID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[Template_CustomTag] WITH NOCHECK ADD 
	CONSTRAINT [PK_Template_CustomTag] PRIMARY KEY  CLUSTERED 
	(
		[ID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[Order_Item] WITH NOCHECK ADD 
	CONSTRAINT [DF_Order_OrderType] DEFAULT (1) FOR [OrderType]
GO

ALTER TABLE [dbo].[Admin_Function] ADD 
	CONSTRAINT [FK_Admin_Function_Admin_Module] FOREIGN KEY 
	(
		[ModuleNo]
	) REFERENCES [dbo].[Admin_Module] (
		[ID]
	) ON DELETE CASCADE  ON UPDATE CASCADE 
GO

ALTER TABLE [dbo].[Admin_Item] ADD 
	CONSTRAINT [FK_Admin_Item_Admin_Role] FOREIGN KEY 
	(
		[RoleID]
	) REFERENCES [dbo].[Admin_Role] (
		[ID]
	) ON DELETE CASCADE  ON UPDATE CASCADE 
GO

ALTER TABLE [dbo].[Content_Item] ADD 
	CONSTRAINT [FK_Content_Item_Content_Category] FOREIGN KEY 
	(
		[CategoryID]
	) REFERENCES [dbo].[Content_Category] (
		[ID]
	) ON DELETE CASCADE  ON UPDATE CASCADE 
GO

ALTER TABLE [dbo].[Distribute_Area] ADD 
	CONSTRAINT [FK_Distribute_Area_Distribute_Item] FOREIGN KEY 
	(
		[DistributeID]
	) REFERENCES [dbo].[Distribute_Item] (
		[ID]
	) ON DELETE CASCADE  ON UPDATE CASCADE 
GO

ALTER TABLE [dbo].[Member_AmountNote] ADD 
	CONSTRAINT [FK_Member_AmountNote_Member_Item] FOREIGN KEY 
	(
		[MemberID]
	) REFERENCES [dbo].[Member_Item] (
		[ID]
	) ON DELETE CASCADE  ON UPDATE CASCADE 
GO

ALTER TABLE [dbo].[Member_BoughtList] ADD 
	CONSTRAINT [FK_Member_BoughtList_Member_Item] FOREIGN KEY 
	(
		[MemberID]
	) REFERENCES [dbo].[Member_Item] (
		[ID]
	) ON DELETE CASCADE  ON UPDATE CASCADE ,
	CONSTRAINT [FK_Member_BoughtList_Order_Item] FOREIGN KEY 
	(
		[OrderNumber]
	) REFERENCES [dbo].[Order_Item] (
		[OrderNumber]
	) ON DELETE CASCADE  ON UPDATE CASCADE ,
	CONSTRAINT [FK_Member_BoughtList_Product_Item] FOREIGN KEY 
	(
		[ProductID]
	) REFERENCES [dbo].[Product_Item] (
		[ID]
	) ON DELETE CASCADE  ON UPDATE CASCADE 
GO

ALTER TABLE [dbo].[Member_Cash] ADD 
	CONSTRAINT [FK_Member_Cash_Member_Item] FOREIGN KEY 
	(
		[MemberID]
	) REFERENCES [dbo].[Member_Item] (
		[ID]
	) ON DELETE CASCADE  ON UPDATE CASCADE 
GO

ALTER TABLE [dbo].[Member_Complaint] ADD 
	CONSTRAINT [FK_Member_Complaint_Member_Item] FOREIGN KEY 
	(
		[MemberID]
	) REFERENCES [dbo].[Member_Item] (
		[ID]
	) ON DELETE CASCADE  ON UPDATE CASCADE 
GO

ALTER TABLE [dbo].[Member_Consignee] ADD 
	CONSTRAINT [FK_Member_Consignee_Member_Item] FOREIGN KEY 
	(
		[MemberID]
	) REFERENCES [dbo].[Member_Item] (
		[ID]
	) ON DELETE CASCADE  ON UPDATE CASCADE 
GO

ALTER TABLE [dbo].[Member_Coupon] ADD 
	CONSTRAINT [FK_Member_Coupon_Member_Item] FOREIGN KEY 
	(
		[MemberID]
	) REFERENCES [dbo].[Member_Item] (
		[ID]
	) ON DELETE CASCADE  ON UPDATE CASCADE ,
	CONSTRAINT [FK_Member_Coupon_Promotions_Coupon] FOREIGN KEY 
	(
		[CouponID]
	) REFERENCES [dbo].[Promotions_Coupon] (
		[ID]
	) ON DELETE CASCADE  ON UPDATE CASCADE 
GO

ALTER TABLE [dbo].[Member_Favorite] ADD 
	CONSTRAINT [FK_Member_Favorite_Member_Item] FOREIGN KEY 
	(
		[MemberID]
	) REFERENCES [dbo].[Member_Item] (
		[ID]
	) ON DELETE CASCADE  ON UPDATE CASCADE ,
	CONSTRAINT [FK_Member_Favorite_Product_Item] FOREIGN KEY 
	(
		[ProductID]
	) REFERENCES [dbo].[Product_Item] (
		[ID]
	) ON DELETE CASCADE  ON UPDATE CASCADE 
GO

ALTER TABLE [dbo].[Member_Info] ADD 
	CONSTRAINT [FK_Member_Info_Member_Item] FOREIGN KEY 
	(
		[MemberID]
	) REFERENCES [dbo].[Member_Item] (
		[ID]
	) ON DELETE CASCADE  ON UPDATE CASCADE 
GO

ALTER TABLE [dbo].[Member_Item] ADD 
	CONSTRAINT [FK_Member_Item_Member_Level] FOREIGN KEY 
	(
		[LevelID]
	) REFERENCES [dbo].[Member_Level] (
		[ID]
	) ON DELETE CASCADE  ON UPDATE CASCADE 
GO

ALTER TABLE [dbo].[Member_Message] ADD 
	CONSTRAINT [FK_Member_Message_Member_Item] FOREIGN KEY 
	(
		[MemberID]
	) REFERENCES [dbo].[Member_Item] (
		[ID]
	) ON DELETE CASCADE  ON UPDATE CASCADE 
GO

ALTER TABLE [dbo].[Member_Order] ADD 
	CONSTRAINT [FK_Member_Order_Member_Item] FOREIGN KEY 
	(
		[MemberID]
	) REFERENCES [dbo].[Member_Item] (
		[ID]
	) ON DELETE CASCADE  ON UPDATE CASCADE ,
	CONSTRAINT [FK_Member_Order_Order_Item] FOREIGN KEY 
	(
		[OrderNumber]
	) REFERENCES [dbo].[Order_Item] (
		[OrderNumber]
	) ON DELETE CASCADE  ON UPDATE CASCADE 
GO

ALTER TABLE [dbo].[Member_PointNote] ADD 
	CONSTRAINT [FK_Member_PointNote_Member_Item] FOREIGN KEY 
	(
		[MemberID]
	) REFERENCES [dbo].[Member_Item] (
		[ID]
	) ON DELETE CASCADE  ON UPDATE CASCADE 
GO

ALTER TABLE [dbo].[Order_Product] ADD 
	CONSTRAINT [FK_Order_Product_Order_Item] FOREIGN KEY 
	(
		[OrderNumber]
	) REFERENCES [dbo].[Order_Item] (
		[OrderNumber]
	) ON DELETE CASCADE  ON UPDATE CASCADE 
GO

ALTER TABLE [dbo].[Order_State] ADD 
	CONSTRAINT [FK_Order_State_Order_Item] FOREIGN KEY 
	(
		[OrderNumber]
	) REFERENCES [dbo].[Order_Item] (
		[OrderNumber]
	) ON DELETE CASCADE  ON UPDATE CASCADE 
GO

ALTER TABLE [dbo].[Product_Ask] ADD 
	CONSTRAINT [FK_Product_Ask_Member_Item] FOREIGN KEY 
	(
		[MemberID]
	) REFERENCES [dbo].[Member_Item] (
		[ID]
	) ON DELETE CASCADE  ON UPDATE CASCADE ,
	CONSTRAINT [FK_Product_Ask_Product_Item] FOREIGN KEY 
	(
		[ProductID]
	) REFERENCES [dbo].[Product_Item] (
		[ID]
	) ON DELETE CASCADE  ON UPDATE CASCADE 
GO

ALTER TABLE [dbo].[Product_Assemble] ADD 
	CONSTRAINT [FK_Product_Assemble_Product_Item] FOREIGN KEY 
	(
		[ProductID]
	) REFERENCES [dbo].[Product_Item] (
		[ID]
	) ON DELETE CASCADE  ON UPDATE CASCADE 
GO

ALTER TABLE [dbo].[Product_Category_Filter] ADD 
	CONSTRAINT [FK_Product_Category_Filter_Product_Category] FOREIGN KEY 
	(
		[CategoryID]
	) REFERENCES [dbo].[Product_Category] (
		[ID]
	) ON DELETE CASCADE  ON UPDATE CASCADE 
GO

ALTER TABLE [dbo].[Product_Category_Filter_Value] ADD 
	CONSTRAINT [FK_Product_Category_Filter_Value_Product_Category_Filter] FOREIGN KEY 
	(
		[FilterID]
	) REFERENCES [dbo].[Product_Category_Filter] (
		[ID]
	) ON DELETE CASCADE  ON UPDATE CASCADE 
GO

ALTER TABLE [dbo].[Product_Category_Hot] ADD 
	CONSTRAINT [FK_Product_Category_Hot_Product_Category] FOREIGN KEY 
	(
		[CategoryID]
	) REFERENCES [dbo].[Product_Category] (
		[ID]
	) ON DELETE CASCADE  ON UPDATE CASCADE 
GO

ALTER TABLE [dbo].[Product_Filter] ADD 
	CONSTRAINT [FK_Product_Filter_Product_Item] FOREIGN KEY 
	(
		[ProductID]
	) REFERENCES [dbo].[Product_Item] (
		[ID]
	) ON DELETE CASCADE  ON UPDATE CASCADE 
GO

ALTER TABLE [dbo].[Product_Image] ADD 
	CONSTRAINT [FK_Product_Image_Product_Item] FOREIGN KEY 
	(
		[ProductID]
	) REFERENCES [dbo].[Product_Item] (
		[ID]
	) ON DELETE CASCADE  ON UPDATE CASCADE 
GO

ALTER TABLE [dbo].[Product_Item] ADD 
	CONSTRAINT [FK_Product_Item_Product_Category] FOREIGN KEY 
	(
		[CategoryID]
	) REFERENCES [dbo].[Product_Category] (
		[ID]
	) ON DELETE CASCADE  ON UPDATE CASCADE 
GO

ALTER TABLE [dbo].[Product_MemberPrice] ADD 
	CONSTRAINT [FK_Product_MemberPrice_Member_Level] FOREIGN KEY 
	(
		[MemberLevelID]
	) REFERENCES [dbo].[Member_Level] (
		[ID]
	) ON DELETE CASCADE  ON UPDATE CASCADE ,
	CONSTRAINT [FK_Product_MemberPrice_Product_Item] FOREIGN KEY 
	(
		[ProductID]
	) REFERENCES [dbo].[Product_Item] (
		[ID]
	) ON DELETE CASCADE  ON UPDATE CASCADE 
GO

ALTER TABLE [dbo].[Product_MultiImage] ADD 
	CONSTRAINT [FK_Product_MultiImage_Product_Item] FOREIGN KEY 
	(
		[ProductID]
	) REFERENCES [dbo].[Product_Item] (
		[ID]
	) ON DELETE CASCADE  ON UPDATE CASCADE 
GO

ALTER TABLE [dbo].[Product_OOS] ADD 
	CONSTRAINT [FK_Product_OOS_Member_Item] FOREIGN KEY 
	(
		[MemberID]
	) REFERENCES [dbo].[Member_Item] (
		[ID]
	) ON DELETE CASCADE  ON UPDATE CASCADE 
GO

ALTER TABLE [dbo].[Product_Parameter] ADD 
	CONSTRAINT [FK_Product_Parameter_Product_Item] FOREIGN KEY 
	(
		[ProductID]
	) REFERENCES [dbo].[Product_Item] (
		[ID]
	) ON DELETE CASCADE  ON UPDATE CASCADE 
GO

ALTER TABLE [dbo].[Product_Privilege] ADD 
	CONSTRAINT [FK_Product_Privilege_Product_Item] FOREIGN KEY 
	(
		[ProductID]
	) REFERENCES [dbo].[Product_Item] (
		[ID]
	) ON DELETE CASCADE  ON UPDATE CASCADE 
GO

ALTER TABLE [dbo].[Product_Related] ADD 
	CONSTRAINT [FK_Product_Related_Product_Item] FOREIGN KEY 
	(
		[ProductID]
	) REFERENCES [dbo].[Product_Item] (
		[ID]
	) ON DELETE CASCADE  ON UPDATE CASCADE 
GO

ALTER TABLE [dbo].[Product_Review] ADD 
	CONSTRAINT [FK_Product_Review_Member_Item] FOREIGN KEY 
	(
		[MemberID]
	) REFERENCES [dbo].[Member_Item] (
		[ID]
	) ON DELETE CASCADE  ON UPDATE CASCADE ,
	CONSTRAINT [FK_Product_Review_Product_Item] FOREIGN KEY 
	(
		[ProductID]
	) REFERENCES [dbo].[Product_Item] (
		[ID]
	) ON DELETE CASCADE  ON UPDATE CASCADE 
GO

ALTER TABLE [dbo].[Product_Specification] ADD 
	CONSTRAINT [FK_Product_Specification_Product_Item] FOREIGN KEY 
	(
		[ProductID]
	) REFERENCES [dbo].[Product_Item] (
		[ID]
	) ON DELETE CASCADE  ON UPDATE CASCADE 
GO

ALTER TABLE [dbo].[Product_SpecificationImage] ADD 
	CONSTRAINT [FK_Product_SpecificationImage_Product_SpecificationItem] FOREIGN KEY 
	(
		[SpecificationItemID]
	) REFERENCES [dbo].[Product_SpecificationItem] (
		[ID]
	) ON DELETE CASCADE  ON UPDATE CASCADE 
GO

ALTER TABLE [dbo].[Product_SpecificationItem] ADD 
	CONSTRAINT [FK_Product_SpecificationItem_Product_Specification] FOREIGN KEY 
	(
		[SpecificationID]
	) REFERENCES [dbo].[Product_Specification] (
		[ID]
	) ON DELETE CASCADE  ON UPDATE CASCADE 
GO

