CREATE TABLE [dbo].[AD] (
	[ADID] [int] NOT NULL ,
	[Name] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[Content] [ntext] COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[ADWidth] [int] NOT NULL ,
	[ADHight] [int] NOT NULL ,
	[ADTop] [int] NOT NULL ,
	[ADLeft] [int] NOT NULL ,
	[IsOpen] [tinyint] NOT NULL ,
	[AdType] [int] NULL 
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO

CREATE TABLE [dbo].[ADCategory] (
	[ADCategoryID] [int] NOT NULL ,
	[ADCategoryName] [varchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[ADCategoryDesc] [varchar] (100) COLLATE Chinese_PRC_CI_AS NOT NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[Admin] (
	[AdminID] [int] NOT NULL ,
	[Flag] [int] NULL ,
	[Power] [nvarchar] (1000) COLLATE Chinese_PRC_CI_AS NULL ,
	[MemberID] [int] NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[AdvancePayment] (
	[AdvancePaymentID] [int] NOT NULL ,
	[MemberID] [int] NOT NULL ,
	[AdvancePayment] [money] NOT NULL ,
	[Remark] [nvarchar] (200) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[WorkPeople] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[AddTime] [smalldatetime] NOT NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[AgencyDrawing] (
	[AgencyDrawingID] [int] NOT NULL ,
	[MemberID] [int] NOT NULL ,
	[DrawFinance] [decimal](18, 2) NOT NULL ,
	[Balance] [decimal](18, 2) NOT NULL ,
	[AddTime] [datetime] NOT NULL ,
	[DisposeTime] [datetime] NOT NULL ,
	[Remark] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[Status] [int] NOT NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[AgencyFinance] (
	[AgencyFinanceID] [int] NOT NULL ,
	[PeriodNum] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[MemberID] [int] NOT NULL ,
	[Finance] [decimal](18, 2) NOT NULL ,
	[Balance] [decimal](18, 2) NOT NULL ,
	[AddTime] [datetime] NOT NULL ,
	[Remark] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[Agent] (
	[AgentID] [int] NOT NULL ,
	[MemberID] [int] NOT NULL ,
	[MemberName] [nvarchar] (100) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[AgentNo] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[ParentAgent] [int] NOT NULL ,
	[AgentIdentify] [int] NOT NULL ,
	[Address] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[PhoneNumber] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[Email] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[QQ] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[MSN] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[Remark] [ntext] COLLATE Chinese_PRC_CI_AS NULL ,
	[Status] [int] NOT NULL ,
	[Url] [nvarchar] (200) COLLATE Chinese_PRC_CI_AS NULL 
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO

CREATE TABLE [dbo].[AgentDiscount] (
	[AgentDiscountID] [int] NOT NULL ,
	[AgentDis] [decimal](18, 2) NOT NULL ,
	[AgentLower] [decimal](18, 2) NOT NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[Article] (
	[ArticleID] [int] NOT NULL ,
	[Title] [nvarchar] (100) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[Content] [ntext] COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[ArticleCategoryID] [int] NOT NULL ,
	[AddTime] [smalldatetime] NOT NULL 
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO

CREATE TABLE [dbo].[ArticleCategory] (
	[ArticleCategoryID] [int] NOT NULL ,
	[CategoryName] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[CategoryType] [int] NOT NULL ,
	[Url] [nvarchar] (100) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[NewWindow] [tinyint] NOT NULL ,
	[Meta] [nvarchar] (200) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[CategoryAD] [nvarchar] (200) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[Number] [int] NOT NULL ,
	[Sort] [int] NOT NULL ,
	[Status] [int] NOT NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[Brand] (
	[BrandID] [int] NOT NULL ,
	[BrandName] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[Logo] [nvarchar] (100) COLLATE Chinese_PRC_CI_AS NULL ,
	[Description] [nvarchar] (255) COLLATE Chinese_PRC_CI_AS NULL ,
	[Sort] [int] NULL ,
	[Status] [int] NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[Bulletin] (
	[BulletinID] [int] NOT NULL ,
	[Title] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[Body] [ntext] COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[MemberID] [int] NULL ,
	[AddTime] [smalldatetime] NULL ,
	[EndTime] [smalldatetime] NULL 
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO

CREATE TABLE [dbo].[CardContent] (
	[CardContentID] [int] NOT NULL ,
	[Account] [ntext] COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[Pass] [ntext] COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[AddTime] [smalldatetime] NULL ,
	[IsSold] [tinyint] NOT NULL ,
	[SaleTime] [smalldatetime] NULL ,
	[OrderID] [int] NOT NULL ,
	[ProductID] [int] NOT NULL ,
	[MemberID] [int] NOT NULL 
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO

CREATE TABLE [dbo].[CatBrand] (
	[CategoryID] [int] NOT NULL ,
	[BrandID] [int] NOT NULL ,
	[Sort] [int] NOT NULL ,
	[AddTime] [smalldatetime] NOT NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[CatProduct] (
	[CategoryID] [int] NOT NULL ,
	[ProductID] [int] NOT NULL ,
	[Sort] [int] NOT NULL ,
	[AddTime] [smalldatetime] NOT NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[Catalogue] (
	[CatalogueID] [int] NOT NULL ,
	[VersionName] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[CategoryIDs] [ntext] COLLATE Chinese_PRC_CI_AS NULL ,
	[Address] [nvarchar] (255) COLLATE Chinese_PRC_CI_AS NULL ,
	[PostCode] [nvarchar] (10) COLLATE Chinese_PRC_CI_AS NULL ,
	[ReceiverName] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[Mobile] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[Tel] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[Email] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[Remark] [nvarchar] (255) COLLATE Chinese_PRC_CI_AS NULL ,
	[Status] [int] NULL ,
	[AddTime] [datetime] NULL 
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO

CREATE TABLE [dbo].[CatalogueVersion] (
	[CatalogueVersionID] [int] NOT NULL ,
	[VersionName] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[Remark] [ntext] COLLATE Chinese_PRC_CI_AS NULL 
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO

CREATE TABLE [dbo].[Category] (
	[CategoryID] [int] NOT NULL ,
	[Name] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[CustomField] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[ParentID] [int] NOT NULL ,
	[CanAdd] [tinyint] NOT NULL ,
	[ProductNum] [int] NOT NULL ,
	[ProductPageSize] [int] NOT NULL ,
	[InBar] [tinyint] NOT NULL ,
	[InNav] [tinyint] NOT NULL ,
	[PicsAndCSS] [ntext] COLLATE Chinese_PRC_CI_AS NULL ,
	[Logo] [nvarchar] (255) COLLATE Chinese_PRC_CI_AS NULL ,
	[ProductAd] [ntext] COLLATE Chinese_PRC_CI_AS NULL ,
	[HeadAd] [ntext] COLLATE Chinese_PRC_CI_AS NULL ,
	[LastUpdate] [smalldatetime] NULL ,
	[ParentPath] [nvarchar] (255) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[ChildIDs] [nvarchar] (255) COLLATE Chinese_PRC_CI_AS NULL ,
	[Depth] [int] NULL ,
	[Child] [int] NULL ,
	[Sort] [int] NULL ,
	[IsActive] [tinyint] NULL ,
	[IsDeleted] [tinyint] NOT NULL ,
	[IsShow] [int] NULL 
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO

CREATE TABLE [dbo].[CategoryField] (
	[CategoryFieldID] [int] NOT NULL ,
	[CategoryFieldName] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[Config] (
	[ConfigID] [int] NOT NULL ,
	[SiteName] [nvarchar] (255) COLLATE Chinese_PRC_CI_AS NULL ,
	[SiteUrl] [nvarchar] (255) COLLATE Chinese_PRC_CI_AS NULL ,
	[CompanyName] [nvarchar] (255) COLLATE Chinese_PRC_CI_AS NULL ,
	[Linkman] [nvarchar] (255) COLLATE Chinese_PRC_CI_AS NULL ,
	[Phone] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[Mobile] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[Email] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[Postalcode] [nvarchar] (10) COLLATE Chinese_PRC_CI_AS NULL ,
	[Address] [nvarchar] (255) COLLATE Chinese_PRC_CI_AS NULL ,
	[SiteLogo] [ntext] COLLATE Chinese_PRC_CI_AS NULL ,
	[SiteTitle] [nvarchar] (255) COLLATE Chinese_PRC_CI_AS NULL ,
	[MetaDescription] [ntext] COLLATE Chinese_PRC_CI_AS NULL ,
	[MetaKeywords] [ntext] COLLATE Chinese_PRC_CI_AS NULL ,
	[Copyright] [ntext] COLLATE Chinese_PRC_CI_AS NULL ,
	[SmtpServer] [nvarchar] (100) COLLATE Chinese_PRC_CI_AS NULL ,
	[SmtpAccount] [nvarchar] (255) COLLATE Chinese_PRC_CI_AS NULL ,
	[SmtpPassword] [nvarchar] (255) COLLATE Chinese_PRC_CI_AS NULL ,
	[SmtpMailbox] [nvarchar] (255) COLLATE Chinese_PRC_CI_AS NULL ,
	[SmtpPort] [nvarchar] (20) COLLATE Chinese_PRC_CI_AS NULL ,
	[SmtpValidate] [tinyint] NOT NULL ,
	[SmtpCode] [nvarchar] (20) COLLATE Chinese_PRC_CI_AS NULL ,
	[DateFormat] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[MarkUnit] [int] NULL ,
	[ShopStop] [tinyint] NOT NULL ,
	[ShopStopWords] [ntext] COLLATE Chinese_PRC_CI_AS NULL ,
	[UseCache] [tinyint] NOT NULL ,
	[CacheTime] [int] NULL ,
	[LinkAllowApply] [tinyint] NOT NULL ,
	[LinkLogoWidth] [int] NULL ,
	[LinkLogoHeight] [int] NULL ,
	[UploadType] [nvarchar] (255) COLLATE Chinese_PRC_CI_AS NULL ,
	[MaxFileSize] [int] NULL ,
	[ProductPageSize] [int] NULL ,
	[BulletinSizeInIndex] [int] NULL ,
	[NewProductSizeInIndex] [int] NULL ,
	[HotProductSizeInIndex] [int] NULL ,
	[CommendProductSizeInIndex] [int] NULL ,
	[DiscountProductSizeInIndex] [int] NULL ,
	[Language] [nvarchar] (10) COLLATE Chinese_PRC_CI_AS NULL ,
	[TemplateFolder] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[StatsToolName] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[StatsCode] [ntext] COLLATE Chinese_PRC_CI_AS NULL ,
	[StatsLoginUrl] [nvarchar] (255) COLLATE Chinese_PRC_CI_AS NULL ,
	[DefaultHeadAD] [ntext] COLLATE Chinese_PRC_CI_AS NULL ,
	[StorageAlert] [int] NULL ,
	[OrderNumberRule] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[AliPaySettings] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[Settings] [ntext] COLLATE Chinese_PRC_CI_AS NULL ,
	[html] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[SCode] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[PhoneMessage] [ntext] COLLATE Chinese_PRC_CI_AS NULL ,
	[uKeyEnabled] [int] NULL ,
	[UKeyCode] [nvarchar] (255) COLLATE Chinese_PRC_CI_AS NULL ,
	[WatermarkText] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[MemberShowPrice] [int] NULL ,
	[ShowSort] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[XpShopADType] [int] NULL ,
	[MemberMaxAddressCount] [int] NULL ,
	[ProductNoRule] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL 
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO

CREATE TABLE [dbo].[Coupon] (
	[CouponID] [int] NOT NULL ,
	[Name] [varchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[Account] [varchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[Price] [varchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[LowestConsumption] [decimal](18, 0) NOT NULL ,
	[ExpireDate] [datetime] NOT NULL ,
	[Status] [int] NOT NULL ,
	[MemberID] [int] NOT NULL ,
	[Conditions] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[ThumbnailImg] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[GiftPic] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[score] [int] NULL ,
	[Memberdiscount] [char] (4) COLLATE Chinese_PRC_CI_AS NULL ,
	[Type] [int] NULL ,
	[Reviews] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[Remake] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[CouponType] [int] NULL ,
	[Exchangetime] [datetime] NULL ,
	[ExchangeExpireDate] [datetime] NULL ,
	[Usetime] [datetime] NULL ,
	[CouponCount] [int] NULL ,
	[ReadyExchangeCount] [int] NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[CouponMember] (
	[CouponMemberID] [int] NOT NULL ,
	[CouponID] [int] NOT NULL ,
	[MemberID] [int] NOT NULL ,
	[Exchangetime] [datetime] NULL ,
	[Usetime] [datetime] NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[Currency] (
	[CurrencyID] [int] NOT NULL ,
	[Name] [nvarchar] (20) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[Code] [nvarchar] (20) COLLATE Chinese_PRC_CI_AS NULL ,
	[Sign] [nvarchar] (20) COLLATE Chinese_PRC_CI_AS NULL ,
	[Rate] [money] NULL ,
	[IsDefault] [tinyint] NOT NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[CustomFieldItem] (
	[CustomFieldItemID] [int] NOT NULL ,
	[ShopProductID] [int] NULL ,
	[ProductID] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[FieldID] [int] NULL ,
	[ItemName] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[Price] [money] NULL ,
	[Selected] [tinyint] NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[Email] (
	[EmailID] [int] NOT NULL ,
	[Centent] [ntext] COLLATE Chinese_PRC_CI_AS NOT NULL 
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO

CREATE TABLE [dbo].[Favorite] (
	[FavoriteID] [int] NOT NULL ,
	[MemberID] [int] NOT NULL ,
	[ProductID] [int] NOT NULL ,
	[AddTime] [smalldatetime] NOT NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[FiltrateIP] (
	[FiltrateID] [int] NOT NULL ,
	[IP] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[FlashAD] (
	[FlashID] [int] NOT NULL ,
	[FlashName] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[FlashImg] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[FlashLink] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[Sort] [int] NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[Gift] (
	[GiftID] [int] NOT NULL ,
	[GiftName] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[GiftDesc] [ntext] COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[ThumbnailImg] [nvarchar] (100) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[GiftPic] [nvarchar] (100) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[Integral] [int] NOT NULL 
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO

CREATE TABLE [dbo].[GiftOrder] (
	[GiftOrderID] [int] NOT NULL ,
	[MemberID] [int] NOT NULL ,
	[OrderTime] [datetime] NOT NULL ,
	[ReceiverName] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[ReceiverPhone] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[ReceiverEmail] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[ReceiverAddress] [nvarchar] (150) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[ReceiverPostalcode] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[TotalIntegral] [int] NOT NULL ,
	[Gifts] [nvarchar] (100) COLLATE Chinese_PRC_CI_AS NOT NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[GiftOrderItem] (
	[GiftOrderItemID] [int] NOT NULL ,
	[GiftOrderID] [int] NOT NULL ,
	[GiftID] [int] NOT NULL ,
	[GiftName] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[Integral] [int] NOT NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[Link] (
	[LinkID] [int] NOT NULL ,
	[Name] [nvarchar] (100) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[Url] [nvarchar] (255) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[Remark] [nvarchar] (255) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[Logo] [nvarchar] (255) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[AddTime] [smalldatetime] NOT NULL ,
	[Sort] [int] NOT NULL ,
	[Home] [tinyint] NOT NULL ,
	[Passed] [tinyint] NOT NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[Member] (
	[MemberID] [int] NOT NULL ,
	[Name] [nvarchar] (100) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[Password] [nvarchar] (100) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[Email] [nvarchar] (100) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[HideEmail] [tinyint] NOT NULL ,
	[GroupId] [nvarchar] (255) COLLATE Chinese_PRC_CI_AS NULL ,
	[Remarks] [nvarchar] (100) COLLATE Chinese_PRC_CI_AS NULL ,
	[AddDate] [smalldatetime] NOT NULL ,
	[RealName] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[NickName] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[QQ] [nvarchar] (20) COLLATE Chinese_PRC_CI_AS NULL ,
	[ICQ] [nvarchar] (20) COLLATE Chinese_PRC_CI_AS NULL ,
	[MSN] [nvarchar] (100) COLLATE Chinese_PRC_CI_AS NULL ,
	[Phone] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[Mobile] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[Zip] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[Address] [nvarchar] (200) COLLATE Chinese_PRC_CI_AS NULL ,
	[Question] [nvarchar] (255) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[Answer] [nvarchar] (255) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[Sex] [tinyint] NOT NULL ,
	[Birthday] [smalldatetime] NULL ,
	[LastLog] [smalldatetime] NULL ,
	[LogTimes] [int] NULL ,
	[Photo] [nvarchar] (255) COLLATE Chinese_PRC_CI_AS NULL ,
	[Introduction] [nvarchar] (255) COLLATE Chinese_PRC_CI_AS NULL ,
	[AdvancePayment] [money] NULL ,
	[Score] [int] NULL ,
	[Status] [int] NOT NULL ,
	[Code] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[Finance] [decimal](18, 2) NOT NULL ,
	[AddressID] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[MemberGroup] (
	[MemberGroupID] [int] NOT NULL ,
	[GroupName] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[Discount] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[NavBar] (
	[NavBarID] [int] NOT NULL ,
	[NavBarName] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[Link] [nvarchar] (200) COLLATE Chinese_PRC_CI_AS NULL ,
	[Target] [nvarchar] (10) COLLATE Chinese_PRC_CI_AS NULL ,
	[Sort] [int] NOT NULL ,
	[Remark] [nvarchar] (200) COLLATE Chinese_PRC_CI_AS NULL ,
	[Inside] [tinyint] NOT NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[NewBid] (
	[NewBidID] [int] NOT NULL ,
	[NewProductID] [int] NOT NULL ,
	[ReceiverAddress] [nvarchar] (100) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[ReceiverPostalCode] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[ReceiverName] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[ReceiverPhone] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[BidPrice] [decimal](18, 2) NOT NULL ,
	[MemberID] [int] NOT NULL ,
	[MemberName] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[CheckUp] [int] NOT NULL ,
	[OrderID] [int] NOT NULL ,
	[Times] [datetime] NOT NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[NewBuy] (
	[NewBuyID] [int] NOT NULL ,
	[NewProductID] [int] NOT NULL ,
	[ReceiverAddress] [nvarchar] (100) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[ReceiverPostalCode] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[ReceiverName] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[ReceiverPhone] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[BuySum] [int] NOT NULL ,
	[MemberID] [int] NOT NULL ,
	[MemberName] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[CheckUp] [int] NOT NULL ,
	[OrderID] [int] NOT NULL ,
	[Times] [datetime] NOT NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[NewNumber] (
	[NewNumberID] [int] NOT NULL ,
	[NewNumber] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[NewProduct] (
	[NewProductID] [int] NOT NULL ,
	[ProductName] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[ProductNo] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[Picture] [nvarchar] (100) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[LowPrice] [decimal](18, 2) NULL ,
	[TopPrice] [decimal](18, 2) NULL ,
	[Range] [decimal](18, 2) NULL ,
	[PeopleSum] [int] NULL ,
	[DateFrom] [datetime] NULL ,
	[DateTo] [datetime] NULL ,
	[Number] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[Discription] [ntext] COLLATE Chinese_PRC_CI_AS NULL ,
	[Type] [int] NOT NULL ,
	[AlreadyJoin] [int] NULL ,
	[IsVote] [int] NULL ,
	[Status] [int] NULL 
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO

CREATE TABLE [dbo].[News_Article] (
	[ArticleID] [int] NOT NULL ,
	[Title] [nvarchar] (150) COLLATE Chinese_PRC_CI_AS NULL ,
	[Content] [ntext] COLLATE Chinese_PRC_CI_AS NULL ,
	[RootID] [int] NULL ,
	[CategoryID] [int] NULL ,
	[CategoryName] [nvarchar] (255) COLLATE Chinese_PRC_CI_AS NULL ,
	[images] [nvarchar] (255) COLLATE Chinese_PRC_CI_AS NULL ,
	[AddTime] [smalldatetime] NULL ,
	[Writer] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[ArticleFrom] [nvarchar] (150) COLLATE Chinese_PRC_CI_AS NULL ,
	[Hits] [int] NULL ,
	[Keys] [nvarchar] (255) COLLATE Chinese_PRC_CI_AS NULL ,
	[IsHtml] [tinyint] NULL ,
	[IsHot] [tinyint] NULL ,
	[IsTop] [tinyint] NULL ,
	[IsShow] [tinyint] NULL ,
	[UserName] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[IsBest] [tinyint] NULL ,
	[IsCreate] [tinyint] NULL ,
	[EssayNum] [int] NULL ,
	[isFormatRed] [int] NULL 
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO

CREATE TABLE [dbo].[News_Category] (
	[CategoryID] [int] NOT NULL ,
	[CategoryName] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[ParentID] [int] NULL ,
	[ParentPath] [nvarchar] (255) COLLATE Chinese_PRC_CI_AS NULL ,
	[ChildIDs] [nvarchar] (255) COLLATE Chinese_PRC_CI_AS NULL ,
	[Depth] [int] NULL ,
	[RootID] [int] NULL ,
	[Sort] [int] NULL ,
	[Child] [int] NULL ,
	[Readme] [ntext] COLLATE Chinese_PRC_CI_AS NULL ,
	[IsActive] [tinyint] NULL ,
	[ArticleNum] [int] NULL 
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO

CREATE TABLE [dbo].[OrderProduct] (
	[OrderProductID] [int] NOT NULL ,
	[OrderID] [int] NOT NULL ,
	[ProductID] [int] NOT NULL ,
	[Items] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[Quantity] [int] NOT NULL ,
	[UnitPrice] [money] NOT NULL ,
	[SubPrice] [money] NOT NULL ,
	[ItemsPrice] [money] NULL ,
	[Remark] [ntext] COLLATE Chinese_PRC_CI_AS NULL ,
	[IsConfirmed] [tinyint] NOT NULL ,
	[IsPayed] [tinyint] NOT NULL ,
	[IsShipped] [tinyint] NOT NULL ,
	[IsFinished] [tinyint] NOT NULL ,
	[IsDiscount] [tinyint] NOT NULL ,
	[ProductName] [nvarchar] (200) COLLATE Chinese_PRC_CI_AS NULL ,
	[ProductSpecs] [nvarchar] (200) COLLATE Chinese_PRC_CI_AS NULL ,
	[ProductNo] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL 
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO

CREATE TABLE [dbo].[OrderProductItem] (
	[OrderProductItemID] [int] NOT NULL ,
	[OrderProductID] [int] NULL ,
	[Quantity] [int] NULL ,
	[FieldItemID] [int] NULL ,
	[FieldItemName] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[ItemPrice] [money] NULL ,
	[AddTime] [smalldatetime] NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[OrderReview] (
	[OrderReviewID] [int] NOT NULL ,
	[OrderID] [int] NOT NULL ,
	[Body] [nvarchar] (255) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[Reply] [nvarchar] (255) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[Type] [int] NOT NULL ,
	[AddTime] [smalldatetime] NOT NULL ,
	[IP] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[Orders] (
	[OrderID] [int] NOT NULL ,
	[MemberID] [int] NOT NULL ,
	[OrderTime] [smalldatetime] NOT NULL ,
	[ShipTime] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[BuyerName] [nvarchar] (255) COLLATE Chinese_PRC_CI_AS NULL ,
	[BuyerPhone] [nvarchar] (255) COLLATE Chinese_PRC_CI_AS NULL ,
	[BuyerEmail] [nvarchar] (255) COLLATE Chinese_PRC_CI_AS NULL ,
	[BuyerAddress] [nvarchar] (255) COLLATE Chinese_PRC_CI_AS NULL ,
	[BuyerPostalcode] [nvarchar] (20) COLLATE Chinese_PRC_CI_AS NULL ,
	[ReceiverName] [nvarchar] (255) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[ReceiverPhone] [nvarchar] (255) COLLATE Chinese_PRC_CI_AS NULL ,
	[ReceiverEmail] [nvarchar] (255) COLLATE Chinese_PRC_CI_AS NULL ,
	[ReceiverAddress] [nvarchar] (255) COLLATE Chinese_PRC_CI_AS NULL ,
	[ReceiverPostalcode] [nvarchar] (20) COLLATE Chinese_PRC_CI_AS NULL ,
	[Remark] [ntext] COLLATE Chinese_PRC_CI_AS NULL ,
	[TotalPrice] [money] NOT NULL ,
	[ProductPrice] [money] NOT NULL ,
	[CustomItemPrice] [money] NULL ,
	[Discount] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[ShipPrice] [money] NOT NULL ,
	[AdvancePayment] [money] NULL ,
	[PaymentType] [int] NOT NULL ,
	[ShippingType] [int] NOT NULL ,
	[Score] [int] NULL ,
	[Weight] [decimal](10, 0) NOT NULL ,
	[Quantity] [int] NOT NULL ,
	[NeedInvoice] [tinyint] NOT NULL ,
	[InvoiceHead] [nvarchar] (255) COLLATE Chinese_PRC_CI_AS NULL ,
	[IsCancelled] [tinyint] NOT NULL ,
	[IsConfirmed] [tinyint] NOT NULL ,
	[PayStatus] [int] NOT NULL ,
	[ShippingStatus] [int] NOT NULL ,
	[IsFinished] [tinyint] NOT NULL ,
	[ManageHistory] [ntext] COLLATE Chinese_PRC_CI_AS NULL ,
	[LastModify] [int] NULL ,
	[OrderNo] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[Code] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[IsAgentF] [int] NULL ,
	[IsAgentFContent] [nvarchar] (100) COLLATE Chinese_PRC_CI_AS NULL ,
	[IsShippingFree] [int] NULL ,
	[IsToMessage] [tinyint] NOT NULL 
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO

CREATE TABLE [dbo].[Payment] (
	[PaymentID] [int] NOT NULL ,
	[Name] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[InterfaceID] [int] NOT NULL ,
	[UserID] [nvarchar] (255) COLLATE Chinese_PRC_CI_AS NULL ,
	[PrivateKey] [nvarchar] (255) COLLATE Chinese_PRC_CI_AS NULL ,
	[SupportCoins] [nvarchar] (255) COLLATE Chinese_PRC_CI_AS NULL ,
	[Description] [ntext] COLLATE Chinese_PRC_CI_AS NULL ,
	[Sort] [int] NULL ,
	[Status] [int] NULL 
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO

CREATE TABLE [dbo].[Poll] (
	[PollID] [int] NOT NULL ,
	[Title] [nvarchar] (255) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[Items] [nvarchar] (255) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[Vote] [nvarchar] (255) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[Multiple] [tinyint] NOT NULL ,
	[inIndex] [tinyint] NOT NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[Product] (
	[ProductID] [int] NOT NULL ,
	[Name] [nvarchar] (255) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[ProductNo] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[Brand] [nvarchar] (255) COLLATE Chinese_PRC_CI_AS NULL ,
	[CustomFieldValues] [ntext] COLLATE Chinese_PRC_CI_AS NULL ,
	[ShortDesc] [nvarchar] (255) COLLATE Chinese_PRC_CI_AS NULL ,
	[Unit] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[Weight] [money] NOT NULL ,
	[MarketPrice] [decimal](18, 2) NOT NULL ,
	[MemberPrice] [decimal](18, 2) NOT NULL ,
	[Score] [int] NULL ,
	[ThumbnailImg] [nvarchar] (255) COLLATE Chinese_PRC_CI_AS NULL ,
	[ProductImg] [nvarchar] (255) COLLATE Chinese_PRC_CI_AS NULL ,
	[Description] [ntext] COLLATE Chinese_PRC_CI_AS NULL ,
	[Storage] [int] NULL ,
	[MiniNum] [int] NULL ,
	[IsForSale] [tinyint] NOT NULL ,
	[IsCommend] [tinyint] NOT NULL ,
	[IsHot] [tinyint] NOT NULL ,
	[IsSpecialOffer] [tinyint] NOT NULL ,
	[AddTime] [smalldatetime] NOT NULL ,
	[Status] [int] NULL ,
	[Sort] [int] NULL ,
	[IsVirtual] [tinyint] NOT NULL ,
	[CanReview] [tinyint] NOT NULL ,
	[IsDiscount] [tinyint] NOT NULL ,
	[RelatedProductIDs] [nvarchar] (200) COLLATE Chinese_PRC_CI_AS NULL ,
	[RelatedImgs] [nvarchar] (255) COLLATE Chinese_PRC_CI_AS NULL ,
	[Hits] [int] NULL ,
	[Min] [int] NULL ,
	[CustomChoice] [nvarchar] (200) COLLATE Chinese_PRC_CI_AS NULL ,
	[SaleNum] [int] NULL ,
	[Title] [nvarchar] (500) COLLATE Chinese_PRC_CI_AS NULL ,
	[MetaKeywords] [ntext] COLLATE Chinese_PRC_CI_AS NULL ,
	[MetaDescription] [ntext] COLLATE Chinese_PRC_CI_AS NULL 
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO

CREATE TABLE [dbo].[ProductCustomField] (
	[ProductCustomFieldID] [int] NOT NULL ,
	[ProductID] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[FieldName] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[Multiple] [tinyint] NULL ,
	[Countable] [tinyint] NULL ,
	[ItemNum] [int] NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[ProductField] (
	[ProductFieldID] [int] NOT NULL ,
	[FieldName] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[FieldValues] [ntext] COLLATE Chinese_PRC_CI_AS NULL ,
	[AddToAdvSearch] [tinyint] NULL ,
	[IsMultiple] [tinyint] NULL ,
	[IsChoice] [tinyint] NULL ,
	[CategoryFieldID] [int] NOT NULL ,
	[IsUseImg] [int] NOT NULL ,
	[ProductFieldImgs] [nvarchar] (2000) COLLATE Chinese_PRC_CI_AS NOT NULL 
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO

CREATE TABLE [dbo].[ReceiverAddress] (
	[ReceiverAddressID] [int] NOT NULL ,
	[ReceiverName] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[ReceiverAddress] [nvarchar] (200) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[ReceiverZip] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[ReceiverPhone] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[ReceiverMobile] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[MemberID] [int] NOT NULL ,
	[AddressID] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[Review] (
	[ReviewID] [int] NOT NULL ,
	[ProductID] [int] NOT NULL ,
	[UserName] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[Email] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[HideEmail] [tinyint] NULL ,
	[Body] [nvarchar] (255) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[Reply] [nvarchar] (255) COLLATE Chinese_PRC_CI_AS NULL ,
	[AddTime] [smalldatetime] NOT NULL ,
	[IP] [nvarchar] (20) COLLATE Chinese_PRC_CI_AS NULL ,
	[MemberID] [int] NOT NULL ,
	[Status] [int] NULL ,
	[Score] [int] NULL ,
	[IsToMessage] [tinyint] NOT NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[Shipping] (
	[ShippingID] [int] NOT NULL ,
	[Name] [nvarchar] (255) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[Price] [nvarchar] (255) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[Description] [ntext] COLLATE Chinese_PRC_CI_AS NULL 
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO

CREATE TABLE [dbo].[ShippingArea] (
	[ShippingAreaID] [int] NOT NULL ,
	[Name] [nvarchar] (255) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[Code] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[ParentID] [int] NOT NULL ,
	[Description] [ntext] COLLATE Chinese_PRC_CI_AS NULL ,
	[Sort] [int] NULL ,
	[Least] [decimal](18, 2) NOT NULL 
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO

CREATE TABLE [dbo].[ShippingExpression] (
	[ShippingExpressionID] [int] NOT NULL ,
	[Name] [nvarchar] (255) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[Expression] [nvarchar] (255) COLLATE Chinese_PRC_CI_AS NOT NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[ShippingFree] (
	[ShippingFreeID] [int] NOT NULL ,
	[FreeType] [int] NOT NULL ,
	[LeastMoney] [decimal](18, 2) NOT NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[ShippingPrice] (
	[ShippingPriceID] [int] NOT NULL ,
	[ShippingAreaID] [int] NOT NULL ,
	[ShippingID] [int] NOT NULL ,
	[ShippingExpression] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[ShoppingCart] (
	[RecordID] [int] NOT NULL ,
	[CartID] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[Quantity] [int] NOT NULL ,
	[ProductID] [int] NOT NULL ,
	[Items] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[AddTime] [smalldatetime] NOT NULL ,
	[ProductSpecs] [nvarchar] (200) COLLATE Chinese_PRC_CI_AS NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[ShoppingCartProductItems] (
	[ItemID] [int] NOT NULL ,
	[RecordID] [int] NULL ,
	[Quantity] [int] NULL ,
	[FieldItemID] [int] NULL ,
	[AddTime] [smalldatetime] NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[Storage] (
	[StorageID] [int] NOT NULL ,
	[ProductNo] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[Amount] [int] NOT NULL ,
	[Warehousing] [int] NOT NULL ,
	[Leave] [int] NOT NULL ,
	[MemberID] [int] NOT NULL ,
	[Times] [datetime] NOT NULL ,
	[Remark] [ntext] COLLATE Chinese_PRC_CI_AS NULL 
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO

CREATE TABLE [dbo].[StorageCheck] (
	[StorageCheckID] [int] NOT NULL ,
	[ProductNo] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[Amount] [int] NOT NULL ,
	[Warehousing] [int] NOT NULL ,
	[Leave] [int] NOT NULL ,
	[MemberID] [int] NOT NULL ,
	[Times] [datetime] NOT NULL ,
	[Remark] [ntext] COLLATE Chinese_PRC_CI_AS NULL ,
	[Issue] [nvarchar] (10) COLLATE Chinese_PRC_CI_AS NOT NULL 
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO

CREATE TABLE [dbo].[Template] (
	[TemplateID] [int] NOT NULL ,
	[Name] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[Folder] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[Sort] [int] NOT NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[Union] (
	[UnionID] [int] NOT NULL ,
	[UnionName] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL ,
	[Image] [nvarchar] (500) COLLATE Chinese_PRC_CI_AS NOT NULL
) ON [PRIMARY]
GO

ALTER TABLE [dbo].[AD] WITH NOCHECK ADD 
	CONSTRAINT [PK_AD] PRIMARY KEY  CLUSTERED 
	(
		[ADID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[ADCategory] WITH NOCHECK ADD 
	CONSTRAINT [PK_ADCategory] PRIMARY KEY  CLUSTERED 
	(
		[ADCategoryID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[Admin] WITH NOCHECK ADD 
	CONSTRAINT [PK_Admin] PRIMARY KEY  CLUSTERED 
	(
		[AdminID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[AdvancePayment] WITH NOCHECK ADD 
	CONSTRAINT [PK_AdvancePayment] PRIMARY KEY  CLUSTERED 
	(
		[AdvancePaymentID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[AgencyDrawing] WITH NOCHECK ADD 
	CONSTRAINT [PK_AgencyDrawing] PRIMARY KEY  CLUSTERED 
	(
		[AgencyDrawingID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[AgencyFinance] WITH NOCHECK ADD 
	CONSTRAINT [PK_AgencyFinance] PRIMARY KEY  CLUSTERED 
	(
		[AgencyFinanceID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[Agent] WITH NOCHECK ADD 
	CONSTRAINT [PK_Agent] PRIMARY KEY  CLUSTERED 
	(
		[AgentID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[AgentDiscount] WITH NOCHECK ADD 
	CONSTRAINT [PK_AgentDiscount] PRIMARY KEY  CLUSTERED 
	(
		[AgentDiscountID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[Article] WITH NOCHECK ADD 
	CONSTRAINT [PK_Article] PRIMARY KEY  CLUSTERED 
	(
		[ArticleID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[ArticleCategory] WITH NOCHECK ADD 
	CONSTRAINT [PK_ArticleCategory] PRIMARY KEY  CLUSTERED 
	(
		[ArticleCategoryID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[Brand] WITH NOCHECK ADD 
	CONSTRAINT [PK_Brand] PRIMARY KEY  CLUSTERED 
	(
		[BrandID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[Bulletin] WITH NOCHECK ADD 
	CONSTRAINT [PK_Bulletin] PRIMARY KEY  CLUSTERED 
	(
		[BulletinID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[CardContent] WITH NOCHECK ADD 
	CONSTRAINT [PK_CardContent] PRIMARY KEY  CLUSTERED 
	(
		[CardContentID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[Catalogue] WITH NOCHECK ADD 
	CONSTRAINT [PK_Catalogue] PRIMARY KEY  CLUSTERED 
	(
		[CatalogueID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[CatalogueVersion] WITH NOCHECK ADD 
	CONSTRAINT [PK_CatalogueVersion] PRIMARY KEY  CLUSTERED 
	(
		[CatalogueVersionID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[Category] WITH NOCHECK ADD 
	CONSTRAINT [PK_Category] PRIMARY KEY  CLUSTERED 
	(
		[CategoryID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[CategoryField] WITH NOCHECK ADD 
	 PRIMARY KEY  CLUSTERED 
	(
		[CategoryFieldID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[Config] WITH NOCHECK ADD 
	CONSTRAINT [PK_Config] PRIMARY KEY  CLUSTERED 
	(
		[ConfigID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[Coupon] WITH NOCHECK ADD 
	CONSTRAINT [PK_Coupon] PRIMARY KEY  CLUSTERED 
	(
		[CouponID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[CouponMember] WITH NOCHECK ADD 
	CONSTRAINT [PK_MemCoupon] PRIMARY KEY  CLUSTERED 
	(
		[CouponMemberID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[Currency] WITH NOCHECK ADD 
	CONSTRAINT [PK_Currency] PRIMARY KEY  CLUSTERED 
	(
		[CurrencyID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[CustomFieldItem] WITH NOCHECK ADD 
	CONSTRAINT [PK_CustomFieldItem] PRIMARY KEY  CLUSTERED 
	(
		[CustomFieldItemID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[Email] WITH NOCHECK ADD 
	CONSTRAINT [PK_Email] PRIMARY KEY  CLUSTERED 
	(
		[EmailID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[Favorite] WITH NOCHECK ADD 
	CONSTRAINT [PK_Favorite] PRIMARY KEY  CLUSTERED 
	(
		[FavoriteID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[FiltrateIP] WITH NOCHECK ADD 
	CONSTRAINT [PK_FiltrateIP] PRIMARY KEY  CLUSTERED 
	(
		[FiltrateID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[FlashAD] WITH NOCHECK ADD 
	CONSTRAINT [PK_FlashAD] PRIMARY KEY  CLUSTERED 
	(
		[FlashID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[Gift] WITH NOCHECK ADD 
	CONSTRAINT [PK_Gift] PRIMARY KEY  CLUSTERED 
	(
		[GiftID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[GiftOrder] WITH NOCHECK ADD 
	CONSTRAINT [PK_GiftOrder] PRIMARY KEY  CLUSTERED 
	(
		[GiftOrderID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[GiftOrderItem] WITH NOCHECK ADD 
	CONSTRAINT [PK_GiftOrderItem] PRIMARY KEY  CLUSTERED 
	(
		[GiftOrderItemID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[Link] WITH NOCHECK ADD 
	CONSTRAINT [PK_Link] PRIMARY KEY  CLUSTERED 
	(
		[LinkID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[Member] WITH NOCHECK ADD 
	CONSTRAINT [PK_Member] PRIMARY KEY  CLUSTERED 
	(
		[MemberID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[MemberGroup] WITH NOCHECK ADD 
	CONSTRAINT [PK_MemberGroup] PRIMARY KEY  CLUSTERED 
	(
		[MemberGroupID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[NewBid] WITH NOCHECK ADD 
	CONSTRAINT [PK_NewBid] PRIMARY KEY  CLUSTERED 
	(
		[NewBidID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[NewBuy] WITH NOCHECK ADD 
	CONSTRAINT [PK_NewBuy] PRIMARY KEY  CLUSTERED 
	(
		[NewBuyID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[NewNumber] WITH NOCHECK ADD 
	CONSTRAINT [PK_NewNumber] PRIMARY KEY  CLUSTERED 
	(
		[NewNumberID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[NewProduct] WITH NOCHECK ADD 
	CONSTRAINT [PK_NewProduct] PRIMARY KEY  CLUSTERED 
	(
		[NewProductID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[News_Article] WITH NOCHECK ADD 
	CONSTRAINT [PK_News_Article] PRIMARY KEY  CLUSTERED 
	(
		[ArticleID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[News_Category] WITH NOCHECK ADD 
	CONSTRAINT [PK_News_Category] PRIMARY KEY  CLUSTERED 
	(
		[CategoryID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[OrderProduct] WITH NOCHECK ADD 
	CONSTRAINT [PK_OrderProduct] PRIMARY KEY  CLUSTERED 
	(
		[OrderProductID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[OrderProductItem] WITH NOCHECK ADD 
	CONSTRAINT [PK_OrderProductItem] PRIMARY KEY  CLUSTERED 
	(
		[OrderProductItemID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[OrderReview] WITH NOCHECK ADD 
	CONSTRAINT [PK_OrderReview] PRIMARY KEY  CLUSTERED 
	(
		[OrderReviewID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[Orders] WITH NOCHECK ADD 
	CONSTRAINT [PK_Orders] PRIMARY KEY  CLUSTERED 
	(
		[OrderID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[Payment] WITH NOCHECK ADD 
	CONSTRAINT [PK_Payment] PRIMARY KEY  CLUSTERED 
	(
		[PaymentID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[Poll] WITH NOCHECK ADD 
	CONSTRAINT [PK_Poll] PRIMARY KEY  CLUSTERED 
	(
		[PollID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[Product] WITH NOCHECK ADD 
	CONSTRAINT [PK_Product] PRIMARY KEY  CLUSTERED 
	(
		[ProductID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[ProductCustomField] WITH NOCHECK ADD 
	CONSTRAINT [PK_ProductCustomField] PRIMARY KEY  CLUSTERED 
	(
		[ProductCustomFieldID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[ProductField] WITH NOCHECK ADD 
	CONSTRAINT [PK_ProductField] PRIMARY KEY  CLUSTERED 
	(
		[ProductFieldID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[ReceiverAddress] WITH NOCHECK ADD 
	CONSTRAINT [PK_ReceiverAddress] PRIMARY KEY  CLUSTERED 
	(
		[ReceiverAddressID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[Review] WITH NOCHECK ADD 
	CONSTRAINT [PK_Review] PRIMARY KEY  CLUSTERED 
	(
		[ReviewID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[Shipping] WITH NOCHECK ADD 
	CONSTRAINT [PK_Shipping] PRIMARY KEY  CLUSTERED 
	(
		[ShippingID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[ShippingArea] WITH NOCHECK ADD 
	CONSTRAINT [PK_ShippingArea] PRIMARY KEY  CLUSTERED 
	(
		[ShippingAreaID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[ShippingExpression] WITH NOCHECK ADD 
	CONSTRAINT [PK_ShippingExpression] PRIMARY KEY  CLUSTERED 
	(
		[ShippingExpressionID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[ShippingPrice] WITH NOCHECK ADD 
	CONSTRAINT [PK_ShippingPrice] PRIMARY KEY  CLUSTERED 
	(
		[ShippingPriceID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[ShoppingCart] WITH NOCHECK ADD 
	CONSTRAINT [PK_ShoppingCart] PRIMARY KEY  CLUSTERED 
	(
		[RecordID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[ShoppingCartProductItems] WITH NOCHECK ADD 
	CONSTRAINT [PK_ShoppingCartProductItems] PRIMARY KEY  CLUSTERED 
	(
		[ItemID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[Storage] WITH NOCHECK ADD 
	CONSTRAINT [PK_Storage] PRIMARY KEY  CLUSTERED 
	(
		[StorageID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[StorageCheck] WITH NOCHECK ADD 
	CONSTRAINT [PK_Check] PRIMARY KEY  CLUSTERED 
	(
		[StorageCheckID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[Template] WITH NOCHECK ADD 
	CONSTRAINT [PK_Template] PRIMARY KEY  CLUSTERED 
	(
		[TemplateID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[Union] WITH NOCHECK ADD 
	CONSTRAINT [PK_Union] PRIMARY KEY  CLUSTERED 
	(
		[UnionID]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[AgencyDrawing] ADD 
	CONSTRAINT [DF_AgencyDrawing_Remark] DEFAULT ('') FOR [Remark]
GO

ALTER TABLE [dbo].[Coupon] ADD 
	CONSTRAINT [DF_Coupon_Conditions] DEFAULT ('') FOR [Conditions],
	CONSTRAINT [DF_Coupon_score] DEFAULT (0) FOR [score],
	CONSTRAINT [DF_Coupon_Reviews] DEFAULT ('') FOR [Reviews],
	CONSTRAINT [DF_Coupon_Remake] DEFAULT ('') FOR [Remake],
	CONSTRAINT [DF_Coupon_CouponCount] DEFAULT (0) FOR [CouponCount],
	CONSTRAINT [DF_Coupon_ReadyExchangeCount] DEFAULT (0) FOR [ReadyExchangeCount]
GO

ALTER TABLE [dbo].[OrderProduct] ADD 
	CONSTRAINT [DF_OrderProduct_ProductNo] DEFAULT ('') FOR [ProductNo]
GO

ALTER TABLE [dbo].[ProductField] ADD 
	CONSTRAINT [DF__ProductFi__Categ__24E777C3] DEFAULT (1) FOR [CategoryFieldID],
	CONSTRAINT [DF__ProductFi__IsUse__25DB9BFC] DEFAULT (0) FOR [IsUseImg],
	CONSTRAINT [DF__ProductFi__Produ__26CFC035] DEFAULT ('') FOR [ProductFieldImgs]
GO

ALTER TABLE [dbo].[CatBrand] ADD 
	CONSTRAINT [FK_CatBrand_Brand] FOREIGN KEY 
	(
		[BrandID]
	) REFERENCES [dbo].[Brand] (
		[BrandID]
	) ON DELETE CASCADE ,
	CONSTRAINT [FK_CatBrand_Category] FOREIGN KEY 
	(
		[CategoryID]
	) REFERENCES [dbo].[Category] (
		[CategoryID]
	)
GO

ALTER TABLE [dbo].[CatProduct] ADD 
	CONSTRAINT [FK_CatProduct_Category] FOREIGN KEY 
	(
		[CategoryID]
	) REFERENCES [dbo].[Category] (
		[CategoryID]
	),
	CONSTRAINT [FK_CatProduct_Product] FOREIGN KEY 
	(
		[ProductID]
	) REFERENCES [dbo].[Product] (
		[ProductID]
	) ON DELETE CASCADE 
GO

ALTER TABLE [dbo].[CouponMember] ADD 
	CONSTRAINT [FK_CouponMember_Coupon] FOREIGN KEY 
	(
		[CouponID]
	) REFERENCES [dbo].[Coupon] (
		[CouponID]
	) ON DELETE CASCADE ,
	CONSTRAINT [FK_CouponMember_Member] FOREIGN KEY 
	(
		[MemberID]
	) REFERENCES [dbo].[Member] (
		[MemberID]
	) ON DELETE CASCADE 
GO

ALTER TABLE [dbo].[News_Article] ADD 
	CONSTRAINT [FK_News_Article_News_Category] FOREIGN KEY 
	(
		[CategoryID]
	) REFERENCES [dbo].[News_Category] (
		[CategoryID]
	) ON DELETE CASCADE 
GO

ALTER TABLE [dbo].[OrderProduct] ADD 
	CONSTRAINT [FK_OrderProduct_Orders] FOREIGN KEY 
	(
		[OrderID]
	) REFERENCES [dbo].[Orders] (
		[OrderID]
	) ON DELETE CASCADE  NOT FOR REPLICATION 
GO

ALTER TABLE [dbo].[ProductField] ADD 
	CONSTRAINT [FK_ProductField_CategoryField] FOREIGN KEY 
	(
		[CategoryFieldID]
	) REFERENCES [dbo].[CategoryField] (
		[CategoryFieldID]
	)
GO
CREATE VIEW [dbo].AgencyIDFinance
AS
SELECT TOP 100 PERCENT [dbo].Orders.TotalPrice * [dbo].AgentDiscount.AgentDis / 100 AS AgencyIDFinance,
       [dbo].Orders.IsCancelled, [dbo].Orders.OrderTime, 
      [dbo].Agent.MemberID AS AgentMemberID, 
      [dbo].Agent.MemberName AS AgentmemberName, [dbo].AgentDiscount.AgentDiscountID, 
      [dbo].Agent.ParentAgent, [dbo].AgentDiscount.AgentDis, [dbo].Agent.AgentID
FROM [dbo].Agent INNER JOIN
      [dbo].Orders ON [dbo].Agent.AgentNo = [dbo].Orders.Code CROSS JOIN
      [dbo].AgentDiscount
WHERE ([dbo].AgentDiscount.AgentDiscountID = 2 OR
      [dbo].AgentDiscount.AgentDiscountID = 3) AND ([dbo].Agent.Status = 1) AND 
      ([dbo].Agent.ParentAgent <> 0) AND ([dbo].Orders.PayStatus = 2)
ORDER BY [dbo].AgentDiscount.AgentDiscountID
GO
CREATE VIEW [dbo].Non_Payment
AS
SELECT [dbo].Orders.OrderTime, [dbo].Agent.Status
FROM [dbo].Orders INNER JOIN
      [dbo].Agent ON [dbo].Orders.Code = [dbo].Agent.AgentNo
WHERE ([dbo].Orders.PayStatus <> 2) AND ([dbo].Orders.IsCancelled = 0) AND 
      ([dbo].Agent.Status = 1)
GO
CREATE VIEW [dbo].AgencyIDFinance_1
AS
SELECT TOP 100 PERCENT [dbo].AgencyIDFinance.AgencyIDFinance, 
      [dbo].AgencyIDFinance.OrderTime, [dbo].Agent.MemberID AS AgentMemberID, 
      [dbo].AgencyIDFinance.AgentDis, [dbo].Agent.AgentIdentify
FROM [dbo].AgencyIDFinance INNER JOIN
      [dbo].Agent ON [dbo].AgencyIDFinance.AgentID = [dbo].Agent.AgentID
WHERE ([dbo].AgencyIDFinance.AgentDiscountID = 3)
ORDER BY [dbo].Agent.MemberID
GO
CREATE VIEW [dbo].AgencyIDFinance_2
AS
SELECT TOP 100 PERCENT [dbo].AgencyIDFinance.AgencyIDFinance, 
      [dbo].AgencyIDFinance.OrderTime, [dbo].Agent.MemberID AS AgentMemberID, 
      [dbo].AgencyIDFinance.AgentDis, [dbo].Agent.AgentIdentify
FROM [dbo].AgencyIDFinance INNER JOIN
      [dbo].Agent ON [dbo].AgencyIDFinance.ParentAgent = [dbo].Agent.AgentID
WHERE ([dbo].AgencyIDFinance.AgentDiscountID = 2)
ORDER BY [dbo].Agent.MemberID