/****** Object: Table [dbo].[Sweepstakes] Script Date: 12/15/2014 08:50:41 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Sweepstakes](
[id] [int] IDENTITY(1,1) NOT NULL,
[title] [nvarchar](200) NOT NULL,
[detail] [ntext] NOT NULL,
[startTime] [datetime] NOT NULL,
[endTime] [datetime] NOT NULL,
[iHit] [int] NOT NULL,
[ParticipateTimes] [int] NOT NULL,
[ModifyTime] [datetime] NOT NULL,
[bActive] [bit] NOT NULL,
[keyword] [nvarchar](200) NOT NULL,
[dayTryTimes] [int] NOT NULL,
[iTotalTime] [int] NOT NULL,
CONSTRAINT [PK_Sweepstakes] PRIMARY KEY CLUSTERED
(
[id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'活动名称' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Sweepstakes', @level2type=N'COLUMN',@level2name=N'title'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'活动详细' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Sweepstakes', @level2type=N'COLUMN',@level2name=N'detail'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'活动开始时间' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Sweepstakes', @level2type=N'COLUMN',@level2name=N'startTime'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'活动结束时间' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Sweepstakes', @level2type=N'COLUMN',@level2name=N'endTime'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'点击数' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Sweepstakes', @level2type=N'COLUMN',@level2name=N'iHit'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'参与人次' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Sweepstakes', @level2type=N'COLUMN',@level2name=N'ParticipateTimes'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'最后编辑时间' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Sweepstakes', @level2type=N'COLUMN',@level2name=N'ModifyTime'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'是否启用' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Sweepstakes', @level2type=N'COLUMN',@level2name=N'bActive'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'抽奖关键字' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Sweepstakes', @level2type=N'COLUMN',@level2name=N'keyword'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'每人每天可抽奖次数(-1表示无限制)' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Sweepstakes', @level2type=N'COLUMN',@level2name=N'dayTryTimes'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'每人总共可抽奖次数(-1表示无限制)' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Sweepstakes', @level2type=N'COLUMN',@level2name=N'iTotalTime'
GO
ALTER TABLE [dbo].[Sweepstakes] ADD CONSTRAINT [DF_Sweepstakes_title] DEFAULT (N'') FOR [title]
GO
ALTER TABLE [dbo].[Sweepstakes] ADD CONSTRAINT [DF_Sweepstakes_detail] DEFAULT (N'') FOR [detail]
GO
ALTER TABLE [dbo].[Sweepstakes] ADD CONSTRAINT [DF_Sweepstakes_bActive] DEFAULT ((0)) FOR [bActive]
GO
ALTER TABLE [dbo].[Sweepstakes] ADD CONSTRAINT [DF_Sweepstakes_dayTryTimes] DEFAULT ((1)) FOR [dayTryTimes]
GO
ALTER TABLE [dbo].[Sweepstakes] ADD CONSTRAINT [DF_Sweepstakes_iTotalTime] DEFAULT ((-1)) FOR [iTotalTime]
GO
/****** Object: Table [dbo].[SweepstakesItem] Script Date: 12/15/2014 08:52:21 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[SweepstakesItem](
[id] [int] IDENTITY(1,1) NOT NULL,
[iSweepstakesId] [int] NOT NULL,
[itemName] [nvarchar](50) NOT NULL,
[Prize] [nvarchar](200) NOT NULL,
[PrizePic] [nvarchar](200) NOT NULL,
[Probability] [decimal](18, 9) NOT NULL,
[MaxCount] [int] NOT NULL,
[iOrder] [int] NOT NULL,
CONSTRAINT [PK_SweepstakesItem] PRIMARY KEY CLUSTERED
(
[id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'奖项名称' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SweepstakesItem', @level2type=N'COLUMN',@level2name=N'itemName'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'奖品' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SweepstakesItem', @level2type=N'COLUMN',@level2name=N'Prize'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'奖品图片' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SweepstakesItem', @level2type=N'COLUMN',@level2name=N'PrizePic'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'中奖机率' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SweepstakesItem', @level2type=N'COLUMN',@level2name=N'Probability'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'奖项最多人数' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SweepstakesItem', @level2type=N'COLUMN',@level2name=N'MaxCount'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'排序' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SweepstakesItem', @level2type=N'COLUMN',@level2name=N'iOrder'
GO
ALTER TABLE [dbo].[SweepstakesItem] ADD CONSTRAINT [DF_SweepstakesItem_itemName] DEFAULT (N'') FOR [itemName]
GO
ALTER TABLE [dbo].[SweepstakesItem] ADD CONSTRAINT [DF_SweepstakesItem_Prize] DEFAULT (N'') FOR [Prize]
GO
ALTER TABLE [dbo].[SweepstakesItem] ADD CONSTRAINT [DF_SweepstakesItem_PrizePic] DEFAULT (N'') FOR [PrizePic]
GO
ALTER TABLE [dbo].[SweepstakesItem] ADD CONSTRAINT [DF_SweepstakesItem_Probability] DEFAULT ((0)) FOR [Probability]
GO
ALTER TABLE [dbo].[SweepstakesItem] ADD CONSTRAINT [DF_SweepstakesItem_MaxCount] DEFAULT ((0)) FOR [MaxCount]
GO
ALTER TABLE [dbo].[SweepstakesItem] ADD CONSTRAINT [DF_SweepstakesItem_iOrder] DEFAULT ((0)) FOR [iOrder]
GO
USE [db_ShopBest]
GO
/****** Object: Table [dbo].[SweepStakesRecord] Script Date: 12/15/2014 08:52:31 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[SweepStakesRecord](
[id] [bigint] IDENTITY(1,1) NOT NULL,
[Man] [nvarchar](100) NOT NULL,
[ManIP] [nvarchar](50) NOT NULL,
[iSweepstakesId] [int] NOT NULL,
[date] [datetime] NOT NULL
) ON [PRIMARY]
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'参与者' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SweepStakesRecord', @level2type=N'COLUMN',@level2name=N'Man'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'参与者IP' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SweepStakesRecord', @level2type=N'COLUMN',@level2name=N'ManIP'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'抽奖活动id' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SweepStakesRecord', @level2type=N'COLUMN',@level2name=N'iSweepstakesId'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'抽奖日期' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SweepStakesRecord', @level2type=N'COLUMN',@level2name=N'date'
GO
ALTER TABLE [dbo].[SweepStakesRecord] ADD CONSTRAINT [DF_SweepStakesRecord_date] DEFAULT (getdate()) FOR [date]
GO
USE [db_ShopBest]
GO
/****** Object: Table [dbo].[SweepstakesWinning] Script Date: 12/15/2014 08:52:39 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[SweepstakesWinning](
[id] [int] IDENTITY(1,1) NOT NULL,
[WinningMan] [nvarchar](50) NOT NULL,
[winningNumber] [nvarchar](200) NOT NULL,
[iSweepstakesId] [int] NOT NULL,
[iItemId] [int] NOT NULL,
[WinningTime] [datetime] NOT NULL,
[bUsed] [bit] NOT NULL,
[bUsedTime] [datetime] NULL,
[bUsedIP] [nvarchar](50) NOT NULL,
CONSTRAINT [PK_SweepstakesWinning] PRIMARY KEY CLUSTERED
(
[id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'中奖者' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SweepstakesWinning', @level2type=N'COLUMN',@level2name=N'WinningMan'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'中奖密码' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SweepstakesWinning', @level2type=N'COLUMN',@level2name=N'winningNumber'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'活动id' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SweepstakesWinning', @level2type=N'COLUMN',@level2name=N'iSweepstakesId'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'奖项id' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SweepstakesWinning', @level2type=N'COLUMN',@level2name=N'iItemId'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'中奖时间' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SweepstakesWinning', @level2type=N'COLUMN',@level2name=N'WinningTime'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'密码是否已使用' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SweepstakesWinning', @level2type=N'COLUMN',@level2name=N'bUsed'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'密码被使用时间' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SweepstakesWinning', @level2type=N'COLUMN',@level2name=N'bUsedTime'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'被使用IP' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SweepstakesWinning', @level2type=N'COLUMN',@level2name=N'bUsedIP'
GO
ALTER TABLE [dbo].[SweepstakesWinning] ADD CONSTRAINT [DF_SweepstakesWinning_WinningMan] DEFAULT (N'') FOR [WinningMan]
GO
ALTER TABLE [dbo].[SweepstakesWinning] ADD CONSTRAINT [DF_SweepstakesWinning_bUsedIP] DEFAULT (N'') FOR [bUsedIP]
GO