/****** Object:  Database LuckBet    Script Date: 2009-02-13 15:26:07 ******/
IF EXISTS (SELECT name FROM master.dbo.sysdatabases WHERE name = N'LuckBet')
	DROP DATABASE [LuckBet]
GO

CREATE DATABASE [LuckBet]  ON (NAME = N'LuckBet_Data', FILENAME = N'E:\My Web\LuckBet\Data\LuckBet_Data.MDF' , SIZE = 177, FILEGROWTH = 10%) LOG ON (NAME = N'LuckBet_Log', FILENAME = N'E:\My Web\LuckBet\Data\LuckBet_log.LDF' , FILEGROWTH = 10%)
 COLLATE Chinese_PRC_CI_AS
GO

exec sp_dboption N'LuckBet', N'autoclose', N'false'
GO

exec sp_dboption N'LuckBet', N'bulkcopy', N'false'
GO

exec sp_dboption N'LuckBet', N'trunc. log', N'true'
GO

exec sp_dboption N'LuckBet', N'torn page detection', N'true'
GO

exec sp_dboption N'LuckBet', N'read only', N'false'
GO

exec sp_dboption N'LuckBet', N'dbo use', N'false'
GO

exec sp_dboption N'LuckBet', N'single', N'false'
GO

exec sp_dboption N'LuckBet', N'autoshrink', N'true'
GO

exec sp_dboption N'LuckBet', N'ANSI null default', N'false'
GO

exec sp_dboption N'LuckBet', N'recursive triggers', N'false'
GO

exec sp_dboption N'LuckBet', N'ANSI nulls', N'false'
GO

exec sp_dboption N'LuckBet', N'concat null yields null', N'false'
GO

exec sp_dboption N'LuckBet', N'cursor close on commit', N'false'
GO

exec sp_dboption N'LuckBet', N'default to local cursor', N'false'
GO

exec sp_dboption N'LuckBet', N'quoted identifier', N'false'
GO

exec sp_dboption N'LuckBet', N'ANSI warnings', N'false'
GO

exec sp_dboption N'LuckBet', N'auto create statistics', N'true'
GO

exec sp_dboption N'LuckBet', N'auto update statistics', N'true'
GO

use [LuckBet]
GO

/****** Object:  Stored Procedure dbo.Page_News    Script Date: 2009-02-13 15:26:09 ******/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Page_News]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[Page_News]
GO

/****** Object:  Stored Procedure dbo.ZipData    Script Date: 2009-02-13 15:26:09 ******/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[ZipData]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[ZipData]
GO

/****** Object:  Table [dbo].[CC_28bet]    Script Date: 2009-02-13 15:26:09 ******/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[CC_28bet]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[CC_28bet]
GO

/****** Object:  Table [dbo].[CC_28betting]    Script Date: 2009-02-13 15:26:09 ******/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[CC_28betting]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[CC_28betting]
GO

/****** Object:  Table [dbo].[CC_News]    Script Date: 2009-02-13 15:26:09 ******/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[CC_News]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[CC_News]
GO

/****** Object:  Table [dbo].[CC_NewsClass]    Script Date: 2009-02-13 15:26:09 ******/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[CC_NewsClass]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[CC_NewsClass]
GO

/****** Object:  Table [dbo].[CC_Prizejl]    Script Date: 2009-02-13 15:26:09 ******/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[CC_Prizejl]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[CC_Prizejl]
GO

/****** Object:  Table [dbo].[CC_Pro_Info]    Script Date: 2009-02-13 15:26:09 ******/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[CC_Pro_Info]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[CC_Pro_Info]
GO

/****** Object:  Table [dbo].[CC_Pro_Kind]    Script Date: 2009-02-13 15:26:09 ******/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[CC_Pro_Kind]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[CC_Pro_Kind]
GO

/****** Object:  Table [dbo].[CC_SysLog]    Script Date: 2009-02-13 15:26:09 ******/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[CC_SysLog]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[CC_SysLog]
GO

/****** Object:  Table [dbo].[CC_WebConfig]    Script Date: 2009-02-13 15:26:09 ******/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[CC_WebConfig]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[CC_WebConfig]
GO

/****** Object:  Table [dbo].[CC_aboutCoin]    Script Date: 2009-02-13 15:26:09 ******/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[CC_aboutCoin]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[CC_aboutCoin]
GO

/****** Object:  Table [dbo].[CC_admin]    Script Date: 2009-02-13 15:26:09 ******/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[CC_admin]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[CC_admin]
GO

/****** Object:  Table [dbo].[CC_autobet]    Script Date: 2009-02-13 15:26:09 ******/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[CC_autobet]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[CC_autobet]
GO

/****** Object:  Table [dbo].[CC_bbsContent]    Script Date: 2009-02-13 15:26:09 ******/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[CC_bbsContent]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[CC_bbsContent]
GO

/****** Object:  Table [dbo].[CC_bbsclass]    Script Date: 2009-02-13 15:26:09 ******/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[CC_bbsclass]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[CC_bbsclass]
GO

/****** Object:  Table [dbo].[CC_bbsreply]    Script Date: 2009-02-13 15:26:09 ******/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[CC_bbsreply]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[CC_bbsreply]
GO

/****** Object:  Table [dbo].[CC_coincard]    Script Date: 2009-02-13 15:26:09 ******/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[CC_coincard]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[CC_coincard]
GO

/****** Object:  Table [dbo].[CC_link]    Script Date: 2009-02-13 15:26:09 ******/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[CC_link]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[CC_link]
GO

/****** Object:  Table [dbo].[CC_message]    Script Date: 2009-02-13 15:26:09 ******/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[CC_message]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[CC_message]
GO

/****** Object:  Table [dbo].[CC_set28bet]    Script Date: 2009-02-13 15:26:09 ******/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[CC_set28bet]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[CC_set28bet]
GO

/****** Object:  Table [dbo].[CC_usercard]    Script Date: 2009-02-13 15:26:09 ******/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[CC_usercard]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[CC_usercard]
GO

/****** Object:  Table [dbo].[CC_users]    Script Date: 2009-02-13 15:26:09 ******/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[CC_users]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[CC_users]
GO

/****** Object:  User dbo    Script Date: 2009-02-13 15:26:07 ******/
/****** Object:  Table [dbo].[CC_28bet]    Script Date: 2009-02-13 15:26:09 ******/
CREATE TABLE [dbo].[CC_28bet] (
	[id] [int] IDENTITY (1, 1) NOT NULL ,
	[bet_number] [int] NOT NULL ,
	[bet_opendate] [datetime] NULL ,
	[bet_result] [int] NULL ,
	[bet_PV] [numeric](18, 4) NULL ,
	[bet_betAmount] [int] NULL ,
	[bet_coinAmount] [int] NULL ,
	[bet_winNumber] [int] NULL ,
	[bet_ThreeNumber] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[bet_state] [int] NULL 
) ON [PRIMARY]
GO

/****** Object:  Table [dbo].[CC_28betting]    Script Date: 2009-02-13 15:26:10 ******/
CREATE TABLE [dbo].[CC_28betting] (
	[ID] [int] IDENTITY (1, 1) NOT NULL ,
	[btg_betnumber] [int] NULL ,
	[btg_result] [int] NULL ,
	[btg_userid] [int] NULL ,
	[btg_coin] [int] NULL ,
	[btg_GetCoin] [int] NULL ,
	[btg_date] [datetime] NULL ,
	[btg_precoin] [int] NULL ,
	[btg_openCoin] [int] NULL ,
	[btg_nowCoin] [int] NULL 
) ON [PRIMARY]
GO

/****** Object:  Table [dbo].[CC_News]    Script Date: 2009-02-13 15:26:10 ******/
CREATE TABLE [dbo].[CC_News] (
	[ID] [int] IDENTITY (1, 1) NOT NULL ,
	[Type_oneid] [int] NULL ,
	[Type_one] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[Type_twoid] [int] NULL ,
	[Type_two] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[Type_threeid] [int] NULL ,
	[Type_three] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[Type] [int] NULL ,
	[Title] [varchar] (250) COLLATE Chinese_PRC_CI_AS NULL ,
	[titlecolor] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[Content] [text] COLLATE Chinese_PRC_CI_AS NULL ,
	[hotimg] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[UpTime] [datetime] NULL ,
	[UserName] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[Clicked] [int] NULL 
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO

/****** Object:  Table [dbo].[CC_NewsClass]    Script Date: 2009-02-13 15:26:10 ******/
CREATE TABLE [dbo].[CC_NewsClass] (
	[i] [int] IDENTITY (1, 1) NOT NULL ,
	[id] [int] NULL ,
	[twoid] [int] NULL ,
	[threeid] [int] NULL ,
	[indexid] [int] NULL ,
	[name] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL 
) ON [PRIMARY]
GO

/****** Object:  Table [dbo].[CC_Prizejl]    Script Date: 2009-02-13 15:26:10 ******/
CREATE TABLE [dbo].[CC_Prizejl] (
	[id] [int] IDENTITY (1, 1) NOT NULL ,
	[pj_ptitle] [nvarchar] (200) COLLATE Chinese_PRC_CI_AS NULL ,
	[pj_pid] [int] NULL ,
	[pj_price] [int] NULL ,
	[pj_userid] [int] NULL ,
	[pj_state] [int] NULL ,
	[pj_date] [datetime] NULL ,
	[pj_donedate] [datetime] NULL ,
	[pj_bz] [nvarchar] (500) COLLATE Chinese_PRC_CI_AS NULL ,
	[pj_number] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL 
) ON [PRIMARY]
GO

/****** Object:  Table [dbo].[CC_Pro_Info]    Script Date: 2009-02-13 15:26:10 ******/
CREATE TABLE [dbo].[CC_Pro_Info] (
	[ID] [int] IDENTITY (1, 1) NOT NULL ,
	[ProName] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[ProImage] [varchar] (250) COLLATE Chinese_PRC_CI_AS NULL ,
	[Type_oneid] [int] NULL ,
	[Type_one] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[Type_twoid] [int] NULL ,
	[Type_two] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[Type_threeid] [int] NULL ,
	[pingpai] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[price] [float] NULL ,
	[Pro_memo] [text] COLLATE Chinese_PRC_CI_AS NULL ,
	[Pro_tj] [varchar] (2) COLLATE Chinese_PRC_CI_AS NULL ,
	[Pro_jj] [varchar] (2) COLLATE Chinese_PRC_CI_AS NULL ,
	[Pro_day] [varchar] (2) COLLATE Chinese_PRC_CI_AS NULL ,
	[date] [datetime] NULL ,
	[ClickNum] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[pro_images] [varchar] (200) COLLATE Chinese_PRC_CI_AS NULL ,
	[Pro_dollar] [int] NULL ,
	[Pro_show] [int] NULL ,
	[Pro_downDate] [datetime] NULL 
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO

/****** Object:  Table [dbo].[CC_Pro_Kind]    Script Date: 2009-02-13 15:26:10 ******/
CREATE TABLE [dbo].[CC_Pro_Kind] (
	[I] [int] IDENTITY (1, 1) NOT NULL ,
	[ID] [int] NULL ,
	[twoid] [int] NULL ,
	[threeid] [int] NULL ,
	[name] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[img] [varchar] (80) COLLATE Chinese_PRC_CI_AS NULL ,
	[indexid] [int] NULL 
) ON [PRIMARY]
GO

/****** Object:  Table [dbo].[CC_SysLog]    Script Date: 2009-02-13 15:26:11 ******/
CREATE TABLE [dbo].[CC_SysLog] (
	[ID] [int] IDENTITY (1, 1) NOT NULL ,
	[cz_username] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[cz_ip] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[cz_content] [ntext] COLLATE Chinese_PRC_CI_AS NULL ,
	[cz_date] [datetime] NULL 
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO

/****** Object:  Table [dbo].[CC_WebConfig]    Script Date: 2009-02-13 15:26:11 ******/
CREATE TABLE [dbo].[CC_WebConfig] (
	[ID] [int] IDENTITY (1, 1) NOT NULL ,
	[WebName] [varchar] (250) COLLATE Chinese_PRC_CI_AS NULL ,
	[WebTitle] [text] COLLATE Chinese_PRC_CI_AS NULL ,
	[KeyWords] [text] COLLATE Chinese_PRC_CI_AS NULL ,
	[Description] [text] COLLATE Chinese_PRC_CI_AS NULL ,
	[ICP] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[gl] [text] COLLATE Chinese_PRC_CI_AS NULL ,
	[Footer] [text] COLLATE Chinese_PRC_CI_AS NULL ,
	[about] [text] COLLATE Chinese_PRC_CI_AS NULL ,
	[ContactUs] [text] COLLATE Chinese_PRC_CI_AS NULL ,
	[law] [text] COLLATE Chinese_PRC_CI_AS NULL ,
	[userxy] [text] COLLATE Chinese_PRC_CI_AS NULL ,
	[site_regclose] [int] NULL ,
	[site_Regcoin] [int] NULL ,
	[site_RegScore] [int] NULL ,
	[Site_scoreRate] [float] NULL ,
	[site_Rate] [float] NULL ,
	[site_LoginScore] [int] NULL ,
	[site_topbetCoin] [int] NULL ,
	[site_lowbetCoin] [int] NULL ,
	[site_pvbl] [float] NULL 
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO

/****** Object:  Table [dbo].[CC_aboutCoin]    Script Date: 2009-02-13 15:26:11 ******/
CREATE TABLE [dbo].[CC_aboutCoin] (
	[id] [int] IDENTITY (1, 1) NOT NULL ,
	[ac_userid] [int] NULL ,
	[ac_type] [int] NULL ,
	[ac_note] [nvarchar] (500) COLLATE Chinese_PRC_CI_AS NULL ,
	[ac_Coin] [int] NULL ,
	[ac_money] [int] NULL ,
	[ac_done] [bit] NULL ,
	[ac_cardNumber] [nvarchar] (200) COLLATE Chinese_PRC_CI_AS NULL ,
	[ac_adid] [int] NULL ,
	[ac_adname] [nvarchar] (200) COLLATE Chinese_PRC_CI_AS NULL ,
	[ac_date] [datetime] NULL ,
	[ac_klID] [nvarchar] (200) COLLATE Chinese_PRC_CI_AS NULL ,
	[ac_cftID] [nvarchar] (200) COLLATE Chinese_PRC_CI_AS NULL 
) ON [PRIMARY]
GO

/****** Object:  Table [dbo].[CC_admin]    Script Date: 2009-02-13 15:26:11 ******/
CREATE TABLE [dbo].[CC_admin] (
	[ID] [int] IDENTITY (1, 1) NOT NULL ,
	[UserName] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[password] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL 
) ON [PRIMARY]
GO

/****** Object:  Table [dbo].[CC_autobet]    Script Date: 2009-02-13 15:26:11 ******/
CREATE TABLE [dbo].[CC_autobet] (
	[id] [int] IDENTITY (1, 1) NOT NULL ,
	[abet_userid] [int] NULL ,
	[abet_title] [nvarchar] (100) COLLATE Chinese_PRC_CI_AS NULL ,
	[abet_start] [int] NULL ,
	[abet_stop] [int] NULL ,
	[abet_lowCoin] [int] NULL ,
	[abet_topCoin] [int] NULL ,
	[abet_payCoin] [nvarchar] (500) COLLATE Chinese_PRC_CI_AS NULL ,
	[abet_date] [datetime] NULL ,
	[abet_Use] [bit] NULL ,
	[abet_payCoinTotle] [int] NULL ,
	[abet_winTo] [int] NULL ,
	[abet_loseTo] [int] NULL 
) ON [PRIMARY]
GO

/****** Object:  Table [dbo].[CC_bbsContent]    Script Date: 2009-02-13 15:26:11 ******/
CREATE TABLE [dbo].[CC_bbsContent] (
	[id] [int] IDENTITY (1, 1) NOT NULL ,
	[bc_classid] [int] NULL ,
	[bc_userid] [int] NULL ,
	[bc_title] [nvarchar] (100) COLLATE Chinese_PRC_CI_AS NULL ,
	[bc_content] [ntext] COLLATE Chinese_PRC_CI_AS NULL ,
	[bc_pic] [nvarchar] (200) COLLATE Chinese_PRC_CI_AS NULL ,
	[bc_date] [datetime] NULL ,
	[bc_replyCount] [int] NULL ,
	[bc_LastRUserid] [int] NULL ,
	[bc_LastRdate] [datetime] NULL ,
	[bc_top] [bit] NULL ,
	[bc_best] [bit] NULL ,
	[bc_allSee] [bit] NULL 
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO

/****** Object:  Table [dbo].[CC_bbsclass]    Script Date: 2009-02-13 15:26:11 ******/
CREATE TABLE [dbo].[CC_bbsclass] (
	[id] [int] IDENTITY (1, 1) NOT NULL ,
	[bc_title] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[bc_order] [int] NULL ,
	[bc_managerID] [int] NULL ,
	[bc_NoUseradd] [bit] NULL 
) ON [PRIMARY]
GO

/****** Object:  Table [dbo].[CC_bbsreply]    Script Date: 2009-02-13 15:26:11 ******/
CREATE TABLE [dbo].[CC_bbsreply] (
	[id] [int] IDENTITY (1, 1) NOT NULL ,
	[br_content] [ntext] COLLATE Chinese_PRC_CI_AS NULL ,
	[br_userid] [int] NULL ,
	[br_date] [datetime] NULL ,
	[br_contentid] [int] NULL ,
	[br_pic] [nvarchar] (200) COLLATE Chinese_PRC_CI_AS NULL 
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO

/****** Object:  Table [dbo].[CC_coincard]    Script Date: 2009-02-13 15:26:11 ******/
CREATE TABLE [dbo].[CC_coincard] (
	[id] [int] IDENTITY (1, 1) NOT NULL ,
	[cc_number] [nvarchar] (200) COLLATE Chinese_PRC_CI_AS NULL ,
	[cc_password] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[cc_Coinamount] [int] NULL ,
	[cc_state] [int] NULL ,
	[cc_overdate] [datetime] NULL ,
	[cc_date] [datetime] NULL ,
	[cc_MakeMan] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[cc_userid] [int] NULL ,
	[cc_donedate] [datetime] NULL ,
	[cc_type] [int] NULL 
) ON [PRIMARY]
GO

/****** Object:  Table [dbo].[CC_link]    Script Date: 2009-02-13 15:26:11 ******/
CREATE TABLE [dbo].[CC_link] (
	[ID] [int] IDENTITY (1, 1) NOT NULL ,
	[web] [nvarchar] (255) COLLATE Chinese_PRC_CI_AS NULL ,
	[sm] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[link] [nvarchar] (255) COLLATE Chinese_PRC_CI_AS NULL ,
	[mark] [varchar] (5) COLLATE Chinese_PRC_CI_AS NULL ,
	[addtime] [datetime] NULL 
) ON [PRIMARY]
GO

/****** Object:  Table [dbo].[CC_message]    Script Date: 2009-02-13 15:26:11 ******/
CREATE TABLE [dbo].[CC_message] (
	[id] [int] IDENTITY (1, 1) NOT NULL ,
	[mes_userid] [int] NULL ,
	[mes_senduserid] [int] NULL ,
	[mes_title] [nvarchar] (200) COLLATE Chinese_PRC_CI_AS NULL ,
	[mes_content] [ntext] COLLATE Chinese_PRC_CI_AS NULL ,
	[mes_date] [datetime] NULL ,
	[mes_read] [bit] NULL ,
	[mes_type] [int] NULL ,
	[mes_djid] [int] NULL 
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO

/****** Object:  Table [dbo].[CC_set28bet]    Script Date: 2009-02-13 15:26:11 ******/
CREATE TABLE [dbo].[CC_set28bet] (
	[id] [int] IDENTITY (1, 1) NOT NULL ,
	[sb_betnumber] [int] NULL ,
	[sb_threenumber] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[sb_result] [int] NULL ,
	[sb_date] [datetime] NULL 
) ON [PRIMARY]
GO

/****** Object:  Table [dbo].[CC_usercard]    Script Date: 2009-02-13 15:26:11 ******/
CREATE TABLE [dbo].[CC_usercard] (
	[ID] [int] IDENTITY (1, 1) NOT NULL ,
	[uc_Userid] [int] NULL ,
	[uc_cardNum] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[uc_cardtype] [int] NULL ,
	[uc_fromdate] [datetime] NULL ,
	[uc_overdate] [datetime] NULL ,
	[uc_usertimes] [int] NULL ,
	[uc_userdate] [datetime] NULL 
) ON [PRIMARY]
GO

/****** Object:  Table [dbo].[CC_users]    Script Date: 2009-02-13 15:26:12 ******/
CREATE TABLE [dbo].[CC_users] (
	[id] [int] IDENTITY (1, 1) NOT NULL ,
	[user_name] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[user_password] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[user_nickname] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[user_number] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[user_card] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[user_phone] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[user_qq] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[user_email] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[user_truename] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[user_addr] [nvarchar] (500) COLLATE Chinese_PRC_CI_AS NULL ,
	[user_zipcard] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[user_vocational] [nvarchar] (200) COLLATE Chinese_PRC_CI_AS NULL ,
	[user_sign] [nvarchar] (500) COLLATE Chinese_PRC_CI_AS NULL ,
	[user_type] [int] NULL ,
	[user_coin] [int] NULL ,
	[user_score] [int] NULL ,
	[user_TotleMoney] [int] NULL ,
	[user_TotleCoin] [int] NULL ,
	[user_tjuserID] [int] NULL ,
	[user_date] [datetime] NULL ,
	[user_CZTimes] [int] NULL ,
	[user_loginTimes] [int] NULL ,
	[user_lastloginIP] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[user_lastLoginDate] [datetime] NULL ,
	[user_vipDate] [datetime] NULL ,
	[user_cardpic] [nvarchar] (500) COLLATE Chinese_PRC_CI_AS NULL ,
	[user_lock] [bit] NULL ,
	[user_djTotleCoin] [int] NULL ,
	[user_bbsCount] [int] NULL ,
	[user_NewestWnumber] [int] NULL ,
	[User_jjjdate] [datetime] NULL ,
	[User_jjjtimes] [int] NULL ,
	[user_coinBox] [int] NULL ,
	[user_coinboxpas] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
	[user_vipcard] [int] NULL 
) ON [PRIMARY]
GO

ALTER TABLE [dbo].[CC_28bet] WITH NOCHECK ADD 
	CONSTRAINT [PK_kele800_28bet] PRIMARY KEY  CLUSTERED 
	(
		[bet_number]
	)  ON [PRIMARY] 
GO

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

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

ALTER TABLE [dbo].[CC_NewsClass] WITH NOCHECK ADD 
	CONSTRAINT [PK_NewsClass] PRIMARY KEY  CLUSTERED 
	(
		[i]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[CC_Prizejl] WITH NOCHECK ADD 
	CONSTRAINT [PK_CC_Projl] PRIMARY KEY  CLUSTERED 
	(
		[id]
	)  ON [PRIMARY] 
GO

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

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

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

ALTER TABLE [dbo].[CC_autobet] WITH NOCHECK ADD 
	CONSTRAINT [PK_CC_autobet] PRIMARY KEY  CLUSTERED 
	(
		[id]
	)  ON [PRIMARY] 
GO

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

ALTER TABLE [dbo].[CC_message] WITH NOCHECK ADD 
	CONSTRAINT [PK_CC_message] PRIMARY KEY  CLUSTERED 
	(
		[id]
	)  ON [PRIMARY] 
GO

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

ALTER TABLE [dbo].[CC_users] WITH NOCHECK ADD 
	CONSTRAINT [PK_kele800_users] PRIMARY KEY  CLUSTERED 
	(
		[id]
	)  ON [PRIMARY] 
GO

ALTER TABLE [dbo].[CC_28bet] WITH NOCHECK ADD 
	CONSTRAINT [DF_kele800_28bet_bet_betAmount] DEFAULT (0) FOR [bet_betAmount],
	CONSTRAINT [DF_kele800_28bet_bet_coinAmount] DEFAULT (0) FOR [bet_coinAmount],
	CONSTRAINT [DF_kele800_28bet_bet_winNumber] DEFAULT (0) FOR [bet_winNumber]
GO

ALTER TABLE [dbo].[CC_28betting] WITH NOCHECK ADD 
	CONSTRAINT [DF_kele800_28betting_btg_coin] DEFAULT (0) FOR [btg_coin],
	CONSTRAINT [DF_kele800_28betting_btg_GetCoin] DEFAULT (0) FOR [btg_GetCoin],
	CONSTRAINT [DF_kele800_28betting_btg_precoin] DEFAULT (0) FOR [btg_precoin],
	CONSTRAINT [DF_kele800_28betting_btg_openCoin] DEFAULT (0) FOR [btg_openCoin],
	CONSTRAINT [DF_kele800_28betting_btg_nowCoin] DEFAULT (0) FOR [btg_nowCoin]
GO

ALTER TABLE [dbo].[CC_News] WITH NOCHECK ADD 
	CONSTRAINT [DF_CC_News_Clicked] DEFAULT (1) FOR [Clicked]
GO

ALTER TABLE [dbo].[CC_Prizejl] WITH NOCHECK ADD 
	CONSTRAINT [DF_kele800_prizejl_pj_state] DEFAULT (1) FOR [pj_state]
GO

ALTER TABLE [dbo].[CC_Pro_Info] WITH NOCHECK ADD 
	CONSTRAINT [DF_YXWC_Pro_Info_Pro_dollar] DEFAULT (0) FOR [Pro_dollar],
	CONSTRAINT [DF_YXWC_Pro_Info_Pro_show] DEFAULT (1) FOR [Pro_show]
GO

ALTER TABLE [dbo].[CC_aboutCoin] WITH NOCHECK ADD 
	CONSTRAINT [DF_kele800_aboutCoin_ac_Coin] DEFAULT (0) FOR [ac_Coin],
	CONSTRAINT [DF_kele800_aboutCoin_ac_money] DEFAULT (0) FOR [ac_money]
GO

ALTER TABLE [dbo].[CC_autobet] WITH NOCHECK ADD 
	CONSTRAINT [DF_kele800_autobet_abet_Use] DEFAULT (0) FOR [abet_Use],
	CONSTRAINT [DF_kele800_autobet_abet_winTo] DEFAULT (0) FOR [abet_winTo],
	CONSTRAINT [DF_kele800_autobet_abet_lostTo] DEFAULT (0) FOR [abet_loseTo]
GO

ALTER TABLE [dbo].[CC_bbsContent] WITH NOCHECK ADD 
	CONSTRAINT [DF_kele800_bbsContent_bc_replyCount] DEFAULT (0) FOR [bc_replyCount],
	CONSTRAINT [DF_kele800_bbsContent_bc_top] DEFAULT (0) FOR [bc_top],
	CONSTRAINT [DF_kele800_bbsContent_bc_best] DEFAULT (0) FOR [bc_best],
	CONSTRAINT [DF_kele800_bbsContent_bc_allSee] DEFAULT (0) FOR [bc_allSee]
GO

ALTER TABLE [dbo].[CC_bbsclass] WITH NOCHECK ADD 
	CONSTRAINT [DF_kele800_bbsclass_bc_NoUseradd] DEFAULT (0) FOR [bc_NoUseradd]
GO

ALTER TABLE [dbo].[CC_coincard] WITH NOCHECK ADD 
	CONSTRAINT [DF_kele800_coincard_cc_state] DEFAULT (1) FOR [cc_state]
GO

ALTER TABLE [dbo].[CC_link] WITH NOCHECK ADD 
	CONSTRAINT [DF_ccyueqi_link_web] DEFAULT ('') FOR [web],
	CONSTRAINT [DF_ccyueqi_link_mark] DEFAULT ('no') FOR [mark],
	CONSTRAINT [DF_ccyueqi_link_addtime] DEFAULT (getdate()) FOR [addtime]
GO

ALTER TABLE [dbo].[CC_message] WITH NOCHECK ADD 
	CONSTRAINT [DF_kele800_message_mes_read] DEFAULT (0) FOR [mes_read],
	CONSTRAINT [DF_kele800_message_mes_type] DEFAULT (0) FOR [mes_type]
GO

ALTER TABLE [dbo].[CC_users] WITH NOCHECK ADD 
	CONSTRAINT [DF_kele800_users_user_type] DEFAULT (1) FOR [user_type],
	CONSTRAINT [DF_kele800_users_user_coin] DEFAULT (0) FOR [user_coin],
	CONSTRAINT [DF_kele800_users_user_score] DEFAULT (0) FOR [user_score],
	CONSTRAINT [DF_kele800_users_user_TotleMoney] DEFAULT (0) FOR [user_TotleMoney],
	CONSTRAINT [DF_kele800_users_user_TotleCoin] DEFAULT (0) FOR [user_TotleCoin],
	CONSTRAINT [DF_kele800_users_user_CZTimes] DEFAULT (0) FOR [user_CZTimes],
	CONSTRAINT [DF_kele800_users_user_loginTimes] DEFAULT (0) FOR [user_loginTimes],
	CONSTRAINT [DF_kele800_users_user_lock] DEFAULT (0) FOR [user_lock],
	CONSTRAINT [DF_kele800_users_user_djTotleCoin] DEFAULT (0) FOR [user_djTotleCoin],
	CONSTRAINT [DF_kele800_users_user_bbsCount] DEFAULT (0) FOR [user_bbsCount]
GO

 CREATE  INDEX [IX_kele800_28betting] ON [dbo].[CC_28betting]([btg_betnumber] DESC , [btg_userid] DESC ) ON [PRIMARY]
GO

SET QUOTED_IDENTIFIER ON 
GO
SET ANSI_NULLS OFF 
GO

/****** Object:  Stored Procedure dbo.Page_News    Script Date: 2009-02-13 15:26:12 ******/

/****** Object:  Stored Procedure dbo.Page_News    Script Date: 2009-02-10 14:02:30 ******/
CREATE proc Page_News
@RecordCount int output,--记录数
@QueryStr nvarchar(100),--表名、视图名、查询语句
@PageSize int=20,  --每页的大小(行数)
@PageCurrent int=1,  --要显示的页
@FdShow nvarchar (1000)='*', --要显示的字段列表
@IdentityStr nvarchar (100)='id', --主键
@WhereStr nvarchar (200)='1=1 ',
@FdOrder nvarchar(100)='id', --排序
@isReturn bit=0 --1为返回,0为执行

as
declare
@sql nvarchar(2000)
set @sql = ''
if @WhereStr = '' begin
 set @WhereStr = '1=1'
end

declare @tsql nvarchar(200)

if(@isReturn=1)begin
 set @tsql=N'select @RecordCount = count(*) from ' + @QueryStr + ' where ' + @WhereStr
 exec sp_executesql @tsql,N'@RecordCount int output',@RecordCount output
end
else begin
 set @RecordCount = @PageSize * @PageCurrent + 1
end

if @PageCurrent = 1 begin
 set @sql = 'select top ' + cast(@PageSize as nvarchar(3)) + ' ' + @FdShow + ' from ' + @QueryStr + ' where ' + @WhereStr + ' order by ' + @IdentityStr  +'  desc'
end
else begin
 set @sql = 'select top ' + cast(@PageSize as nvarchar(3)) + ' ' + @FdShow + ' from ' + @QueryStr + ' where ' + @WhereStr + ' and ' + @IdentityStr + '< ( select min(' + @IdentityStr + ') from (select top ' + cast(@PageSize*(@PageCurrent-1) as nvarchar(10)) + ' ' + @IdentityStr + ' from ' + @QueryStr + ' where ' + @WhereStr + ' order by ' + @IdentityStr + '  desc) as t) order by ' + @IdentityStr  +'  desc'
end
if @FdOrder <>'' and @FdOrder<>@IdentityStr begin
 set @sql = 'select * from (' + @sql + ') as t4867435348493 order by ' + @FdOrder
end
--print @sql
execute(@sql)

GO

SET QUOTED_IDENTIFIER OFF 
GO
SET ANSI_NULLS ON 
GO

SET QUOTED_IDENTIFIER ON 
GO
SET ANSI_NULLS OFF 
GO

/****** Object:  Stored Procedure dbo.ZipData    Script Date: 2009-02-13 15:26:12 ******/

/****** Object:  Stored Procedure dbo.ZipData    Script Date: 2009-02-10 14:02:30 ******/

/****** Object:  Stored Procedure dbo.ZipData    Script Date: 2008-09-21 21:46:04 ******/

/****** Object:  Stored Procedure dbo.ZipData    Script Date: 2008-09-12 11:35:10 ******/
/****** Object:  Stored Procedure dbo.ZipData    Script Date: 2007-12-25 17:02:34 ******/
CREATE PROCEDURE ZipData
	@DataName            varchar(100)
/*
============================================================
功能:	压缩数据库 
参数:
	@DataName            varchar(100)		:	数据库名称
============================================================
*/
AS
--压缩数据库日志
--1.清空日志
dump transaction @DataName with no_log
--2.截断事务日志：
backup log @DataName with no_log
--3.收缩数据库文件(如果不压缩,数据库的文件不会减小
dbcc shrinkdatabase(@DataName)

GO

SET QUOTED_IDENTIFIER OFF 
GO
SET ANSI_NULLS ON 
GO


exec sp_addextendedproperty N'MS_Description', N'投注总人数', N'user', N'dbo', N'table', N'CC_28bet', N'column', N'bet_betAmount'
GO
exec sp_addextendedproperty N'MS_Description', N'投注总金币数', N'user', N'dbo', N'table', N'CC_28bet', N'column', N'bet_coinAmount'
GO
exec sp_addextendedproperty N'MS_Description', N'状态 1竞猜中 2已开奖', N'user', N'dbo', N'table', N'CC_28bet', N'column', N'bet_state'
GO
exec sp_addextendedproperty N'MS_Description', N'中奖人数', N'user', N'dbo', N'table', N'CC_28bet', N'column', N'bet_winNumber'


GO


exec sp_addextendedproperty N'MS_Description', N'1审核中 2审核无效  3审核有效 4已发货 5取消', N'user', N'dbo', N'table', N'CC_Prizejl', N'column', N'pj_state'


GO


exec sp_addextendedproperty N'MS_Description', N'兑换次数', N'user', N'dbo', N'table', N'CC_Pro_Info', N'column', N'Pro_dollar'
GO
exec sp_addextendedproperty N'MS_Description', N'下架日期', N'user', N'dbo', N'table', N'CC_Pro_Info', N'column', N'Pro_downDate'
GO
exec sp_addextendedproperty N'MS_Description', N'是否显示', N'user', N'dbo', N'table', N'CC_Pro_Info', N'column', N'Pro_show'


GO


exec sp_addextendedproperty N'MS_Description', N'是否已经审核', N'user', N'dbo', N'table', N'CC_aboutCoin', N'column', N'ac_done'
GO
exec sp_addextendedproperty N'MS_Description', N'1金币充值 2广告收入 3推荐收入 4在线充值', N'user', N'dbo', N'table', N'CC_aboutCoin', N'column', N'ac_type'


GO


exec sp_addextendedproperty N'MS_Description', N'所有板块可见', N'user', N'dbo', N'table', N'CC_bbsContent', N'column', N'bc_allSee'
GO
exec sp_addextendedproperty N'MS_Description', N'精华', N'user', N'dbo', N'table', N'CC_bbsContent', N'column', N'bc_best'
GO
exec sp_addextendedproperty N'MS_Description', N'置顶', N'user', N'dbo', N'table', N'CC_bbsContent', N'column', N'bc_top'


GO


exec sp_addextendedproperty N'MS_Description', N'禁止用户发帖', N'user', N'dbo', N'table', N'CC_bbsclass', N'column', N'bc_NoUseradd'


GO


exec sp_addextendedproperty N'MS_Description', N'添加日期', N'user', N'dbo', N'table', N'CC_coincard', N'column', N'cc_date'
GO
exec sp_addextendedproperty N'MS_Description', N'充值日期', N'user', N'dbo', N'table', N'CC_coincard', N'column', N'cc_donedate'
GO
exec sp_addextendedproperty N'MS_Description', N'制卡人', N'user', N'dbo', N'table', N'CC_coincard', N'column', N'cc_MakeMan'
GO
exec sp_addextendedproperty N'MS_Description', N'有效期限', N'user', N'dbo', N'table', N'CC_coincard', N'column', N'cc_overdate'
GO
exec sp_addextendedproperty N'MS_Description', N'1未使用  2已使用  3过期', N'user', N'dbo', N'table', N'CC_coincard', N'column', N'cc_state'
GO
exec sp_addextendedproperty N'MS_Description', N'充值用户id', N'user', N'dbo', N'table', N'CC_coincard', N'column', N'cc_userid'


GO


exec sp_addextendedproperty N'MS_Description', N'兑奖记录ID号', N'user', N'dbo', N'table', N'CC_message', N'column', N'mes_djid'
GO
exec sp_addextendedproperty N'MS_Description', N'999999是系统发送', N'user', N'dbo', N'table', N'CC_message', N'column', N'mes_senduserid'
GO
exec sp_addextendedproperty N'MS_Description', N'信息类别 1是卡密 不显示在收件箱 0是普通信息', N'user', N'dbo', N'table', N'CC_message', N'column', N'mes_type'


GO


exec sp_addextendedproperty N'MS_Description', N'论坛发帖数', N'user', N'dbo', N'table', N'CC_users', N'column', N'user_bbsCount'
GO
exec sp_addextendedproperty N'MS_Description', N'充值次数', N'user', N'dbo', N'table', N'CC_users', N'column', N'user_CZTimes'
GO
exec sp_addextendedproperty N'MS_Description', N'用户兑奖总金额', N'user', N'dbo', N'table', N'CC_users', N'column', N'user_djTotleCoin'
GO
exec sp_addextendedproperty N'MS_Description', N'最近一次中奖旗号', N'user', N'dbo', N'table', N'CC_users', N'column', N'user_NewestWnumber'
GO
exec sp_addextendedproperty N'MS_Description', N'没用', N'user', N'dbo', N'table', N'CC_users', N'column', N'user_nickname'
GO
exec sp_addextendedproperty N'MS_Description', N'没用', N'user', N'dbo', N'table', N'CC_users', N'column', N'user_number'
GO
exec sp_addextendedproperty N'MS_Description', N'1普通 2认证 3待审核', N'user', N'dbo', N'table', N'CC_users', N'column', N'user_type'


GO

