IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Character_back]') AND type in (N'U'))
drop table [dbo].[Character_back]
GO
    CREATE TABLE [Character_back] (
		[AccountID] [varchar] (10) NOT NULL ,
		[Name] [varchar] (10) NOT NULL ,
		[LevelUpPoint] [int] NULL DEFAULT (0),
		[Class] [tinyint] NULL ,
		[Leadership] [smallint] NULL DEFAULT (0),
		[Resets] [int] NOT NULL DEFAULT (0),
		[Relifes] [int] NOT NULL DEFAULT (0),
		[NoResetInDay] [int] NOT NULL DEFAULT (0),
		[NoResetInMonth] [int] NOT NULL DEFAULT (0),
		[PointUyThac] [int] NOT NULL DEFAULT (0),
		[point_event] [int] NOT NULL DEFAULT (0)
	) ON [PRIMARY]
    PRINT 'Tao bang Character_back thanh cong'
GO

IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[CardPhone]') AND type in (N'U'))
drop table [dbo].[CardPhone]
GO
    CREATE TABLE [CardPhone] (
		[stt] [int] IDENTITY (1, 1) NOT NULL ,
		[acc] [varchar] (20) NULL ,
		[Name] [varchar] (10) NULL ,
		[menhgia] [int] NULL ,
		[card_type] [varchar] (20) NULL ,
		[card_num] [varchar] (20) NULL ,
		[card_num_md5] [varchar] (32) NULL ,
		[card_serial] [varchar] (20) NULL ,
		[ngay] [smalldatetime] NULL ,
		[status] [tinyint] NOT NULL DEFAULT (0) ,
		[addvpoint] [varchar] (20) NULL ,
		[timenap] [int] NULL ,
		[timeduyet] [int] NULL,
		[transaction_code] [char] (36) NULL
	) ON [PRIMARY]
    PRINT 'Tao bang CardPhone thanh cong'
GO

IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[DoanhThu]') AND type in (N'U'))
drop table [dbo].[DoanhThu]
GO
    CREATE TABLE [DoanhThu] (
		[id] [int] IDENTITY (1, 1) NOT NULL ,
		[year] [int] NOT NULL DEFAULT (2008),
		[month] [int] NOT NULL DEFAULT (1),
		[money] [int] NOT NULL DEFAULT (0),
		[card_type] [varchar] (20) NULL
	) ON [PRIMARY]
    PRINT 'Tao bang DoanhThu thanh cong'
GO

IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Check_Action]') AND type in (N'U'))
drop table [dbo].[Check_Action]
GO
    CREATE TABLE [Check_Action] (
		[id] [int] IDENTITY (1, 1) NOT NULL ,
		[action] [varchar] (20) NULL ,
		[time] [int] NOT NULL DEFAULT (0),
		[status] [tinyint] NOT NULL DEFAULT (0)
	) ON [PRIMARY]
    PRINT 'Tao bang Check_Action thanh cong'
GO

IF ( NOT EXISTS (SELECT * FROM Check_Action WHERE action = 'Top50') ) BEGIN INSERT INTO Check_Action (action) VALUES ('Top50') END
GO
IF ( NOT EXISTS (SELECT * FROM Check_Action WHERE action = 'ActionDay') ) BEGIN INSERT INTO Check_Action (action) VALUES ('ActionDay') END
GO
IF ( NOT EXISTS (SELECT * FROM Check_Action WHERE action = 'ActionHour') ) BEGIN INSERT INTO Check_Action (action) VALUES ('ActionHour') END
GO
IF ( NOT EXISTS (SELECT * FROM Check_Action WHERE action = 'ActionDay') ) BEGIN INSERT INTO Check_Action (action) VALUES ('ActionDay') END
GO
IF ( NOT EXISTS (SELECT * FROM Check_Action WHERE action = 'ActionMonth') ) BEGIN INSERT INTO Check_Action (action) VALUES ('ActionMonth') END
GO

IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Event_TOP_RS]') AND type in (N'U'))
drop table [dbo].[Event_TOP_RS]
GO
    CREATE TABLE [Event_TOP_RS] (
		[acc] [varchar] (20) NULL ,
		[name] [varchar] (20) NULL ,
		[resets] [int] NOT NULL DEFAULT (0) ,
		[reset_score] [int] NOT NULL DEFAULT (0) ,
		[time] [smalldatetime] NOT NULL DEFAULT (2013-01-01)
	) ON [PRIMARY]
    PRINT 'Tao bang Event_TOP_RS thanh cong'
GO

IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Event_TOP_Point]') AND type in (N'U'))
drop table [dbo].[Event_TOP_Point]
GO
    CREATE TABLE [Event_TOP_Point] (
		[acc] [varchar] (20) NULL ,
		[name] [varchar] (20) NULL ,
		[points] [int] NOT NULL DEFAULT (0) ,
		[slg] [int] NOT NULL DEFAULT (0) ,
		[type] [tinyint] NOT NULL DEFAULT (1) ,
		[time] [smalldatetime] NOT NULL DEFAULT (2013-01-01)
	) ON [PRIMARY]
    PRINT 'Tao bang Event_TOP_Point thanh cong'
GO

IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Event_TOP_Card]') AND type in (N'U'))
drop table [dbo].[Event_TOP_Card]
GO
    CREATE TABLE [Event_TOP_Card] (
		[acc] [varchar] (20) NULL ,
		[gcoin] [bigint] NOT NULL DEFAULT (0) ,
		[time] [smalldatetime] NOT NULL DEFAULT (2013-01-01)
	) ON [PRIMARY]
    PRINT 'Tao bang Event_TOP_Card thanh cong'
GO

IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SMS]') AND type in (N'U'))
drop table [dbo].[SMS]
GO
    CREATE TABLE [SMS] (
		[acc] [varchar] (20) NOT NULL ,
		[KeyXuLy] [varchar] (20) NOT NULL ,
		[time] [int] NOT NULL DEFAULT (0) ,
		[status] [tinyint] NOT NULL DEFAULT (0),
		[Code] [int] NOT NULL DEFAULT (0),
		[dulieu1] [varchar] (50) NULL ,
		[dulieu2] [varchar] (50) NULL ,
		[dulieu3] [varchar] (50) NULL ,
		[dulieu4] [varchar] (50) NULL ,
		[dulieu5] [varchar] (50) NULL
	) ON [PRIMARY]
    PRINT 'Tao bang SMS thanh cong'
GO

IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[PassRan]') AND type in (N'U'))
drop table [dbo].[PassRan]
GO
    CREATE TABLE [PassRan] (
		[acc] [varchar] (10) NULL ,
		[pass] [varchar] (10) NULL,
		[pass_md5] [varchar] (50) NULL
	) ON [PRIMARY]
    PRINT 'Tao bang PassRan thanh cong'
GO

IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Invite]') AND type in (N'U'))
drop table [dbo].[Invite]
GO
    CREATE TABLE [Invite] (
		[acc_invite] [varchar] (10) NOT NULL ,
		[acc_accept] [varchar] (10) NOT NULL ,
		[time_invite] [int] NOT NULL DEFAULT (0) ,
		[vpoint_invite] [int] NOT NULL DEFAULT (0)
	) ON [PRIMARY]
    PRINT 'Tao bang Invite thanh cong'
GO

IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Log_TienTe]') AND type in (N'U'))
drop table [dbo].[Log_TienTe]
GO
    CREATE TABLE [Log_TienTe] (
		[acc] [varchar] (10) NOT NULL,
		[gcoin]	[bigint] DEFAULT (0),
		[gcoin_km] [bigint] DEFAULT (0),
		[vpoint] [bigint] DEFAULT (0),
		[price] [nvarchar] (250),
		[Des] [ntext],
		[time] [int] DEFAULT (0)
	) ON [PRIMARY]
    PRINT 'Tao bang Log_TienTe thanh cong'
GO

IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[bongda_giaidau]') AND type in (N'U'))
drop table [dbo].[bongda_giaidau]
GO
    CREATE TABLE [bongda_giaidau] (
		[giai_id] [int] identity Primary Key NOT NULL ,
		[giai_name] [nvarchar] (200) NOT NULL ,
		[status] [tinyint] DEFAULT (0),
	) ON [PRIMARY]
    PRINT 'Tao bang bongda_giaidau thanh cong'
GO

IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[bongda_tran]') AND type in (N'U'))
drop table [dbo].[bongda_tran]
GO
    CREATE TABLE [bongda_tran] (
		[tran_id] [int] identity Primary Key NOT NULL ,
		[tran_doi1] [nvarchar] (200) NOT NULL ,
		[tran_doi2] [nvarchar] (200) NOT NULL ,
		[giai_id] [int] DEFAULT(0) ,
		[tran_kq1] [smallint] DEFAULT (0),
		[tran_kq2] [smallint] DEFAULT (0),
		[time] [int] NOT NULL,
		[status] [tinyint] DEFAULT (0),
	) ON [PRIMARY]
    PRINT 'Tao bang bongda_tran thanh cong'
GO

IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[bongda_dudoankq]') AND type in (N'U'))
drop table [dbo].[bongda_dudoankq]
GO
    CREATE TABLE [bongda_dudoankq] (
		[dudoan_id] [int] identity Primary Key NOT NULL ,
		[acc] [varchar] (10) NOT NULL ,
		[tran_id] [int] DEFAULT(0) ,
		[dudoan_kq] [smallint] NOT NULL ,
		[dudoan_slg] [int] NOT NULL DEFAULT (0),
		[time] [int] NOT NULL,
		[status] [tinyint] DEFAULT (0),
	) ON [PRIMARY]
    PRINT 'Tao bang bongda_dudoankq thanh cong'
GO

IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[IPBonus]') AND type in (N'U'))
drop table [dbo].[IPBonus]
GO
    CREATE TABLE [IPBonus] (
		[ipbonus_id] [int] identity Primary Key NOT NULL ,
		[acc] [varchar] (10) NOT NULL ,
		[ip] [varchar] (50) NOT NULL ,
		[InternetName] [nvarchar] (200) NOT NULL ,
		[Address] [nvarchar] (250) NOT NULL,
		[QuanHuyen] [nvarchar] (100) NOT NULL,
		[ThanhPho] [nvarchar] (100) NOT NULL,
		[totalacc] [int] NOT NULL DEFAULT(0)
	) ON [PRIMARY]
    PRINT 'Tao bang IPBonus thanh cong'
GO

IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[IPBonus_acc]') AND type in (N'U'))
drop table [dbo].[IPBonus_acc]
GO
    CREATE TABLE [IPBonus_acc] (
		[ipbonus_id] [int] NOT NULL ,
		[acc] [varchar] (10) NOT NULL ,
		CONSTRAINT pk_IPBonus_acc PRIMARY KEY (ipbonus_id,acc)
	) ON [PRIMARY]
    PRINT 'Tao bang IPBonus_acc thanh cong'
GO

IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[GiftCode]') AND type in (N'U'))
drop table [dbo].[GiftCode]
GO
    CREATE TABLE [GiftCode] (
		[gift_code] [varchar] (10) NULL ,
		[acc] [varchar] (10) NULL ,
		[name] [varchar] (10) NULL ,
		[reset] [int] NULL ,
		[type] [tinyint] NOT NULL DEFAULT(0) ,
		[giftcode_type] [tinyint] NULL ,
		[gift_time] [int] NOT NULL ,
		[gift_timeuse] [int] NULL ,
		[ngay] [smalldatetime] NOT NULL ,
		[status] [tinyint] NOT NULL DEFAULT(0)
	) ON [PRIMARY]
    PRINT 'Tao bang GiftCode thanh cong'
GO

IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[GiftLog]') AND type in (N'U'))
drop table [dbo].[GiftLog]
GO
    CREATE TABLE [GiftLog] (
		[acc] [varchar] (10) NOT NULL ,
		[name] [varchar] (10) NULL ,
		[reset] [int] NULL ,
		[type] [tinyint] NOT NULL DEFAULT(0) ,
		[time] [int] NOT NULL
	) ON [PRIMARY]
    PRINT 'Tao bang GiftLog thanh cong'
GO

IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Dupe_Scan]') AND type in (N'U'))
drop table [dbo].[Dupe_Scan]
GO
    CREATE TABLE [Dupe_Scan] (
		[acc] [varchar] (10) NOT NULL ,
		[name] [varchar] (10) NULL ,
		[item] [varchar] (32) NULL ,
		[seri] [varchar] (8) NOT NULL ,
		[vitri] [tinyint] NOT NULL DEFAULT(0), 
		[isdupe] [tinyint] NOT NULL DEFAULT(0),
		[slgitem] [tinyint] NOT NULL DEFAULT(0),
	CONSTRAINT uc_DupeScan UNIQUE (acc,name,seri,vitri)
	) ON [PRIMARY]
    PRINT 'Tao bang Dupe_Scan thanh cong'
GO

IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Dupe_Scan_Online]') AND type in (N'U'))
drop table [dbo].[Dupe_Scan_Online]
GO
    CREATE TABLE [Dupe_Scan_Online] (
		[acc] [varchar] (10) NOT NULL ,
		[name] [varchar] (10) NULL ,
		[item] [varchar] (32) NULL ,
		[seri] [varchar] (8) NOT NULL ,
		[vitri] [tinyint] NOT NULL DEFAULT(0), 
		[isdupe] [tinyint] NOT NULL DEFAULT(0),
	CONSTRAINT uc_DupeScanOnline UNIQUE (acc,name,seri,vitri)
	) ON [PRIMARY]
    PRINT 'Tao bang Dupe_Scan_Online thanh cong'
GO

IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Dupe_Online]') AND type in (N'U'))
drop table [dbo].[Dupe_Online]
GO
    CREATE TABLE [Dupe_Online] (
		[acc] [varchar] (10) NOT NULL ,
		[name] [varchar] (10) NULL ,
		[item] [varchar] (32) NULL ,
		[seri] [varchar] (8) NOT NULL ,
		[vitri] [tinyint] NOT NULL DEFAULT(0), 
		[time] [int] NULL,
	CONSTRAINT uc_DupeScanDupeOnline UNIQUE (acc,name,seri,vitri)
	) ON [PRIMARY]
    PRINT 'Tao bang Dupe_Online thanh cong'
GO

IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[item_vpoint_changed]') AND type in (N'U'))
drop table [dbo].[item_vpoint_changed]
GO
    CREATE TABLE [item_vpoint_changed] (
		[acc] [varchar] (10) NOT NULL ,
		[name] [varchar] (10) NULL ,
		[itemtype] [varchar] (50) NULL ,
		[seri] [varchar] (8) NOT NULL ,
		[value] [int] NOT NULL DEFAULT(0), 
		[time] [int] NULL,
	CONSTRAINT uc_item_vpoint_changed UNIQUE (acc,name,seri)
	) ON [PRIMARY]
    PRINT 'Tao bang item_vpoint_changed thanh cong'
GO

IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[EventEpItem]') AND type in (N'U'))
drop table [dbo].[EventEpItem]
GO
    CREATE TABLE [EventEpItem] (
		[acc] [varchar] (10) NOT NULL ,
		[name] [varchar] (10) NOT NULL ,
		[item] [varchar] (32) NOT NULL ,
		[seri] [varchar] (8) NOT NULL ,
		[lvl] [tinyint] NOT NULL ,
		[image] [varchar] (255) NULL ,
		[time_reg] [int] NOT NULL ,
		[info] [ntext] NULL ,
		[time_finish] [int] NULL ,
		[infoend] [ntext] NULL ,
		[status] [tinyint] NOT NULL DEFAULT 0
	) ON [PRIMARY]
    PRINT 'Tao bang EventEpItem thanh cong'
GO

IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[ItemLock]') AND type in (N'U'))
drop table [dbo].[ItemLock]
GO
    CREATE TABLE [ItemLock] (
		[acc] [varchar] (10) NOT NULL ,
		[name] [varchar] (10) NOT NULL ,
		[item] [varchar] (32) NOT NULL ,
		[seri] [varchar] (8) NOT NULL ,
		[lvl] [tinyint] NOT NULL ,
		[image] [varchar] (255) NULL ,
		[info] [ntext] NULL ,
		[time] [int] NOT NULL,
		[status] [tinyint] NOT NULL DEFAULT (1)		-- 1: Lock, 0: Unlock
	) ON [PRIMARY]
    PRINT 'Tao bang ItemLock thanh cong'
GO

IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[OnePassDay]') AND type in (N'U'))
drop table [dbo].[OnePassDay]
GO
    CREATE TABLE [OnePassDay] (
		[acc] [varchar] (10) NOT NULL ,
		[opd] [varchar] (32) NOT NULL ,
		[time] [int] NOT NULL
	) ON [PRIMARY]
    PRINT 'Tao bang OnePassDay thanh cong'
GO

IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[TopReset]') AND type in (N'U'))
drop table [dbo].[TopReset]
GO
    CREATE TABLE [TopReset] (
		[acc] [varchar] (10) NOT NULL ,
		[name] [varchar] (10) NOT NULL ,
		[reset] [int] NOT NULL DEFAULT(0) ,
		[resetvip] [int] NOT NULL DEFAULT(0) ,
		[reset_uythac] [int] NOT NULL DEFAULT(0) ,
		[reset_over] [int] NOT NULL DEFAULT(0) ,
		[reset_pri] [int] NOT NULL DEFAULT(0) ,
		[reset_all] [int] NOT NULL DEFAULT(0) ,
		[reset_day] [int] NOT NULL DEFAULT(0) ,
		[year] [int] NOT NULL DEFAULT(2012) ,
		[month] [tinyint] NOT NULL DEFAULT(1) ,
		[week] [tinyint] NOT NULL DEFAULT(1) ,
		[day] [tinyint] NOT NULL DEFAULT(1) ,
		[time] [int] NOT NULL ,
		[Time_Created] [smalldatetime] NOT NULL DEFAULT GETDATE()
	) ON [PRIMARY]
    PRINT 'Tao bang TopReset thanh cong'
GO

IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[TopResetScore]') AND type in (N'U'))
drop table [dbo].[TopResetScore]
GO
    CREATE TABLE [TopResetScore] (
		[acc] [varchar] (10) NOT NULL ,
		[name] [varchar] (10) NOT NULL ,
		[reset_score_pri] [bigint] NOT NULL DEFAULT(0) ,
		[reset_score] [bigint] NOT NULL DEFAULT(0) ,
		[year] [int] NOT NULL DEFAULT(2012) ,
		[month] [tinyint] NOT NULL DEFAULT(1) ,
		[week] [tinyint] NOT NULL DEFAULT(1) ,
		[day] [tinyint] NOT NULL DEFAULT(1) ,
		[time] [int] NOT NULL ,
		[Time_Created] [smalldatetime] NOT NULL DEFAULT GETDATE()
	) ON [PRIMARY]
    PRINT 'Tao bang TopResetScore thanh cong'
GO

IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[DauGiaNguoc_Item]') AND type in (N'U'))
drop table [dbo].[DauGiaNguoc_Item]
GO
    CREATE TABLE [DauGiaNguoc_Item] (
		[bid_id] [int] IDENTITY (1, 1) NOT NULL ,
		[item_name] [varchar] (100) NOT NULL ,
		[item_code] [varchar] (32) NOT NULL ,
		[item_info] [ntext] NULL ,
		[item_image] [varchar] (20) NULL ,
		[price_min] [int] NOT NULL DEFAULT (0) ,
		[bid_mod] [int] NOT NULL DEFAULT (0) ,
		[time_begin] [int] NOT NULL DEFAULT (0) ,
		[time_end] [int] NOT NULL DEFAULT (0) ,
		[bid_status] [tinyint] NOT NULL DEFAULT (1),
		[reward_status] [tinyint] NOT NULL DEFAULT (0),
		[reward_time] [int] NULL
	) ON [PRIMARY]
    PRINT 'Tao bang DauGiaNguoc_Item thanh cong'
GO

IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[DauGiaNguoc_TheHe]') AND type in (N'U'))
drop table [dbo].[DauGiaNguoc_TheHe]
GO
    CREATE TABLE [DauGiaNguoc_TheHe] (
		[bid_id] [int] NOT NULL ,
		[thehe] [tinyint] NOT NULL DEFAULT (1)
	) ON [PRIMARY]
    PRINT 'Tao bang DauGiaNguoc_TheHe thanh cong'
GO

IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[DauGia_Item]') AND type in (N'U'))
drop table [dbo].[DauGia_Item]
GO
    CREATE TABLE [DauGia_Item] (
		[bid_id] [int] IDENTITY (1, 1) NOT NULL ,
		[item_name] [varchar] (100) NOT NULL ,
		[item_code] [varchar] (32) NOT NULL ,
		[item_info] [ntext] NULL ,
		[item_image] [varchar] (20) NULL ,
		[item_group] [tinyint] NOT NULL ,
		[price_min] [int] NOT NULL DEFAULT (100) ,
		[price_max] [int] NOT NULL DEFAULT (200) ,
		[bid_end] [int] NOT NULL ,
		[acc_own] [varchar] (10) NOT NULL ,
		[char_own] [varchar] (10) NOT NULL ,
		[itempass] [varchar] (10) NULL ,
		[trade_safe] [tinyint] NOT NULL DEFAULT (0) ,
		[bid_status] [tinyint] NOT NULL DEFAULT (1),
		[reward_status] [tinyint] NOT NULL DEFAULT (0),
		[reward_time] [int] NULL
	) ON [PRIMARY]
    PRINT 'Tao bang DauGia_Item thanh cong'
GO

IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[NBB_Award]') AND type in (N'U'))
drop table [dbo].[NBB_Award]
GO

CREATE TABLE [NBB_Award] (
	[award_id] [int] IDENTITY (1, 1) NOT NULL ,
	[award_info] [varchar] (250) NULL ,
	[item_slg] [tinyint] NOT NULL DEFAULT (1) ,
	[item_name] [nvarchar](MAX) NOT NULL ,
	[item_code] [varchar] (32) NOT NULL ,
	[item_info] [nvarchar](MAX) NULL ,
	[item_image] [varchar] (20) NULL ,
	[seri_block] [tinyint] NOT NULL DEFAULT (0),
	[acc] [varchar] (10) NOT NULL ,
	[name] [varchar] (10) NOT NULL ,
	[status] [tinyint] NOT NULL DEFAULT (0),	-- 0: Chua nhan, 1: Da nhan
	[create_time] [int] NULL,
	[receive_time] [int] NULL,
	[hsd_time] [int] NULL,
	[thuhoi] [tinyint] NULL
) ON [PRIMARY]
PRINT 'Tao bang NBB_Award thanh cong'
GO

IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[nbb_timeonline_date]') AND type in (N'U'))
drop table [dbo].[nbb_timeonline_date]
GO
    CREATE TABLE [nbb_timeonline_date] (
		[acc] [varchar] (10) NOT NULL ,
		[timeonline] [int] NOT NULL DEFAULT(0),
		[date] [smalldatetime] NOT NULL DEFAULT (2013-01-01)
	) ON [PRIMARY]
    PRINT 'Tao bang nbb_timeonline_date thanh cong'
GO

IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[nbb_quest_daily]') AND type in (N'U'))
drop table [dbo].[nbb_quest_daily]
GO
    CREATE TABLE [nbb_quest_daily] (
		[acc] [varchar] (10) NOT NULL ,
		[name] [varchar] (10) NOT NULL ,
		[qindex] [tinyint] NOT NULL DEFAULT(0),
		[date] [smalldatetime] NOT NULL DEFAULT (2013-01-01)
	) ON [PRIMARY]
    PRINT 'Tao bang nbb_quest_daily thanh cong'
GO

IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[nbb_use_money]') AND type in (N'U'))
drop table [dbo].[nbb_use_money]
GO
    CREATE TABLE [nbb_use_money] (
		[acc] [varchar] (10) NOT NULL ,
		[gcoin] [bigint] NOT NULL DEFAULT(0),
		[gcoin_km] [bigint] NOT NULL DEFAULT(0),
		[vpoint] [bigint] NOT NULL DEFAULT(0),
		[date] [smalldatetime] NOT NULL DEFAULT (2013-01-01)
	) ON [PRIMARY]
    PRINT 'Tao bang nbb_use_money thanh cong'
GO

IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[nbb_pl_daily]') AND type in (N'U'))
drop table [dbo].[nbb_pl_daily]
GO
    CREATE TABLE [nbb_pl_daily] (
		[acc] [varchar] (10) NOT NULL ,
		[plpoint] [int] NOT NULL DEFAULT(0),
		[date] [smalldatetime] NOT NULL DEFAULT (2013-01-01)
	) ON [PRIMARY]
    PRINT 'Tao bang nbb_pl_daily thanh cong'
GO

IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[nbb_toppoint]') AND type in (N'U'))
drop table [dbo].[nbb_toppoint]
GO
    CREATE TABLE [nbb_toppoint] (
		[acc] [varchar] (10) NOT NULL ,
		[name] [varchar] (10) NOT NULL ,
		[point_total] [int] NOT NULL DEFAULT (0) ,
		[point_rs] [int] NOT NULL DEFAULT (0) ,
		[point_rsday] [int] NOT NULL DEFAULT (0) ,
		[point_event] [int] NOT NULL DEFAULT (0) ,
		[time_begin] [smalldatetime] NOT NULL,
		[time_update] [smalldatetime] NULL
	) ON [PRIMARY]
    PRINT 'Tao bang nbb_toppoint thanh cong'
GO

IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[nbb_hoanhao]') AND type in (N'U'))
drop table [dbo].[nbb_hoanhao]
GO
    CREATE TABLE [nbb_hoanhao] (
		[acc] [varchar] (10) NOT NULL ,
		[name] [varchar] (10) NOT NULL ,
		[item_serial] [varchar] (8) NOT NULL ,
		[cp] [int] NOT NULL DEFAULT (0),
		[time_begin] [smalldatetime] NOT NULL,
		[time_update] [smalldatetime] NULL
	) ON [PRIMARY]
    PRINT 'Tao bang nbb_hoanhao thanh cong'
GO

IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[nbb_plmarket]') AND type in (N'U'))
drop table [dbo].[nbb_plmarket]
GO
    CREATE TABLE [nbb_plmarket] (
		[market_id] [int] identity Primary Key NOT NULL ,
		[acc] [varchar] (10) NOT NULL ,
		[name] [varchar] (10) NOT NULL ,
		[plpoint] [int] NOT NULL DEFAULT (0),
		[price] [int] NOT NULL DEFAULT (0),
		[tygia] [float] NOT NULL DEFAULT (0),
		[name_buy] [varchar] (10) NULL ,
		[time_begin] [smalldatetime] NOT NULL,
		[time_end] [smalldatetime] NULL,
		[status] [int] NOT NULL DEFAULT (0)			-- 0: �ang b�n | 1: �? b�n | 2: H?y b�n
	) ON [PRIMARY]
    PRINT 'Tao bang nbb_plmarket thanh cong'
GO

IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[nbb_topweek]') AND type in (N'U'))
drop table [dbo].[nbb_topweek]
GO
    CREATE TABLE [nbb_topweek] (
		[acc] [varchar] (10) NOT NULL ,
		[name] [varchar] (10) NOT NULL ,
		[reset_score] [int] NOT NULL DEFAULT(0) ,
		[toptype] [varchar] (50) NOT NULL ,
		[toprank] [tinyint] NOT NULL DEFAULT (99) ,
		[week] [tinyint] NOT NULL DEFAULT (0) ,
		[year] [int] NOT NULL DEFAULT (2013)
	) ON [PRIMARY]

    PRINT 'Tao bang nbb_topweek thanh cong'
GO

IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Log_chuyensv]') AND type in (N'U'))
drop table [dbo].[Log_chuyensv]
GO

CREATE TABLE [dbo].[Log_chuyensv] (
	[id] [int] IDENTITY (1, 1) NOT NULL ,
	[acc] [varchar] (10) COLLATE Latin1_General_CI_AS NOT NULL ,
	[char] [varchar] (10) COLLATE Latin1_General_CI_AS NOT NULL ,
	[accnew] [varchar] (10) COLLATE Latin1_General_CI_AS NOT NULL ,
	[charnew] [varchar] (10) COLLATE Latin1_General_CI_AS NOT NULL ,
	[thoigian] [nvarchar] (50) COLLATE Latin1_General_CI_AS NOT NULL 
) ON [PRIMARY]
PRINT 'Tao bang Log_chuyensv thanh cong'
GO

IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[GiaiTri_LoDe]') AND type in (N'U'))
drop table [dbo].[GiaiTri_LoDe]
GO

CREATE TABLE [dbo].[GiaiTri_LoDe] (
	[ID] [int] IDENTITY (1, 1) NOT NULL ,
	[Account] [varchar] (10) COLLATE Latin1_General_CI_AS NULL ,
	[Num_Bet1] [varchar] (2) COLLATE Latin1_General_CI_AS NULL ,
	[Num_Bet2] [varchar] (2) COLLATE Latin1_General_CI_AS NULL ,
	[Num_Bet3] [varchar] (2) COLLATE Latin1_General_CI_AS NULL ,
	[Num_Bet4] [varchar] (2) COLLATE Latin1_General_CI_AS NULL ,
	[Num_Point] [int] NOT NULL ,
	[Type_play] [varchar] (7) COLLATE Latin1_General_CI_AS NULL ,
	[Type_MoneyBet] [varchar] (6) COLLATE Latin1_General_CI_AS NULL ,
	[Date_Bet] [varchar] (10) COLLATE Latin1_General_CI_AS NULL ,
	[Bet_Status] [tinyint] NULL 
) ON [PRIMARY]
PRINT 'Tao bang GiaiTri_LoDe thanh cong'
GO

IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[ShareFB_VWEB]') AND type in (N'U'))
drop table [dbo].[ShareFB_VWEB]
GO

CREATE TABLE [dbo].[ShareFB_VWEB] (
	[acc] [varchar] (10) COLLATE Latin1_General_CS_AS NOT NULL ,
	[phanthuong] [nvarchar] (250) COLLATE Latin1_General_CI_AS NULL ,
	[Des] [ntext] COLLATE Latin1_General_CI_AS NULL ,
	[time] [int] NULL ,
	[fbid] [nvarchar] (50) COLLATE Latin1_General_CI_AS NULL ,
) ON [PRIMARY]
PRINT 'Tao bang ShareFB_VWEB thanh cong'
GO

IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[EVENT_TONGTOP_VWEB]') AND type in (N'U'))
drop table [dbo].[EVENT_TONGTOP_VWEB]
GO

CREATE TABLE [dbo].[EVENT_TONGTOP_VWEB] (
	[id] [int] IDENTITY (1, 1) NOT NULL ,
	[acc] [varchar] (20) COLLATE Latin1_General_CS_AS NULL ,
	[name] [varchar] (20) COLLATE Latin1_General_CI_AS NULL ,
	[resets] [int] NOT NULL ,
	[card] [bigint] NOT NULL ,
	[time] [smalldatetime] NOT NULL 
) ON [PRIMARY]
PRINT 'Tao bang EVENT_TONGTOP_VWEB thanh cong'
GO

IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[EVENT_TONGTOP_VWEB_KETQUA]') AND type in (N'U'))
drop table [dbo].[EVENT_TONGTOP_VWEB_KETQUA]
GO

CREATE TABLE [dbo].[EVENT_TONGTOP_VWEB_KETQUA] (
	[id] [int] IDENTITY (1, 1) NOT NULL ,
	[acc] [varchar] (20) COLLATE Latin1_General_CS_AS NULL ,
	[name] [varchar] (20) COLLATE Latin1_General_CI_AS NULL ,
	[resets] [int] NOT NULL ,
	[card] [bigint] NOT NULL ,
	[top_resets] [int] NOT NULL ,
	[top_card] [int] NOT NULL ,
	[TongTop] [int] NOT NULL ,
) ON [PRIMARY]
PRINT 'Tao bang EVENT_TONGTOP_VWEB_KETQUA thanh cong'
GO

IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[event_doiitem_vweb]') AND type in (N'U'))
drop table [dbo].[event_doiitem_vweb]
GO

CREATE TABLE [dbo].[event_doiitem_vweb] (
	[acc] [varchar] (10) COLLATE Latin1_General_CS_AS NOT NULL ,
	[name] [varchar] (10) COLLATE Latin1_General_CI_AS NULL ,
	[itemtype] [varchar] (50) COLLATE Latin1_General_CI_AS NULL ,
	[seri] [varchar] (8) COLLATE Latin1_General_CI_AS NOT NULL ,
	[value] [int] NOT NULL ,
	[time] [int] NULL 
) ON [PRIMARY]
PRINT 'Tao bang event_doiitem_vweb thanh cong'
GO

IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Log_ModVweb]') AND type in (N'U'))
drop table [dbo].[Log_ModVweb]
GO

CREATE TABLE [dbo].[Log_ModVweb] (
	[acc] [varchar] (10) COLLATE Latin1_General_CS_AS NOT NULL ,
	[Des] [ntext] COLLATE Latin1_General_CI_AS NULL ,
	[time] [int] NULL 
) ON [PRIMARY]
PRINT 'Tao bang Log_ModVweb thanh cong'
GO

IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[vweb_block]') AND type in (N'U'))
drop table [dbo].[vweb_block]
GO
    CREATE TABLE [vweb_block] (
		[admin] [varchar] (50) NOT NULL ,
		[acc] [varchar] (10) NOT NULL ,
		[block_type] [tinyint] NOT NULL DEFAULT(0) ,
		[block_des] [varchar] (250) NOT NULL ,
		[day_block] [int] NOT NULL DEFAULT(0) ,
		[block_time_begin] [int] NOT NULL DEFAULT(0) ,
		[block_time_end] [int] NULL
	) ON [PRIMARY]
    PRINT 'Tao bang vweb_block thanh cong'
GO

IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[vweb_warehouse_safe]') AND type in (N'U'))
drop table [dbo].[vweb_warehouse_safe]
GO

CREATE TABLE [dbo].[vweb_warehouse_safe] (
		[id] [int] IDENTITY (1, 1) NOT NULL ,
		[acc] [varchar] (10) NOT NULL ,
		[item_code] [varchar] (32) NOT NULL ,
		[item_name] [ntext] NOT NULL ,
		[item_info] [ntext] NULL ,
		[item_serial] [varchar] (8) NOT NULL ,
		[item_image] [varchar] (20) NOT NULL ,
		[time_gui] [int] NOT NULL DEFAULT(0),
		[time_rut] [int] NOT NULL DEFAULT(0),
		[status] [tinyint] NOT NULL DEFAULT(0)				-- 0 : dang trong Warehouse Secure, 1 : Da rut ra
) ON [PRIMARY]
PRINT 'Tao bang vweb_warehouse_safe thanh cong'
GO

IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[JBKhoa_VWebMU]') AND type in (N'U'))
drop table [dbo].[JBKhoa_VWebMU]
GO

CREATE TABLE [dbo].[JBKhoa_VWebMU](
	[acc] [varchar](10) NOT NULL,
	[landao] [int] NOT NULL,
	[year] [int] NOT NULL,
	[month] [tinyint] NOT NULL,
	[day] [tinyint] NOT NULL,
	[time] [int] NOT NULL
) ON [PRIMARY]
PRINT 'Tao bang JBKhoa_VWebMU thanh cong'
GO

IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[DauGia_Bid]') AND type in (N'U'))
drop table [dbo].[DauGia_Bid]
GO
    CREATE TABLE [DauGia_Bid] (
		[bid_id] [int] NOT NULL ,
		[acc] [varchar] (10) NOT NULL ,
		[name] [varchar] (10) NOT NULL ,
		[bid_gcoin] [bigint] NOT NULL DEFAULT (0) ,
		[bid_time] [int] NOT NULL DEFAULT (0) ,
		[status] [tinyint] NOT NULL DEFAULT (1)
	) ON [PRIMARY]
    PRINT 'Tao bang DauGia_Bid thanh cong'
GO

IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[DauGiaNguoc_Bid]') AND type in (N'U'))
drop table [dbo].[DauGiaNguoc_Bid]
GO
    CREATE TABLE [DauGiaNguoc_Bid] (
		[bid_id] [int] NOT NULL ,
		[acc] [varchar] (10) NOT NULL ,
		[name] [varchar] (10) NOT NULL ,
		[bid_gcoin] [bigint] NOT NULL DEFAULT (0) ,
		[bid_time] [int] NOT NULL DEFAULT (0) ,
		[win] [tinyint] NOT NULL DEFAULT (0)
	) ON [PRIMARY]
    PRINT 'Tao bang DauGiaNguoc_Bid thanh cong'
GO

IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[vweb_muathe]') AND type in (N'U'))
drop table [dbo].[vweb_muathe]
GO

CREATE TABLE [dbo].[vweb_muathe] (
	[stt] [int] IDENTITY(1,1) NOT NULL,
	[acc] [varchar] (10) COLLATE Latin1_General_CI_AS NOT NULL ,
	[sdt] [varchar] (20) COLLATE Latin1_General_CI_AS NOT NULL ,
	[loaithe] [varchar] (10) COLLATE Latin1_General_CI_AS NOT NULL ,
	[menhgia] [int] NOT NULL ,
	[soluong] [int] NOT NULL ,
	[status] [int] NOT NULL ,
	[time] [int] NOT NULL 
) ON [PRIMARY]
PRINT 'Tao bang vweb_muathe thanh cong'
GO

IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[vweb_gift_tichluythe]') AND type in (N'U'))
drop table [dbo].[vweb_gift_tichluythe]
GO
    CREATE TABLE [vweb_gift_tichluythe] (
		[acc] [varchar] (10) NOT NULL ,
		[tongthe] [int] NOT NULL DEFAULT(0) ,
		[time] [int] NOT NULL DEFAULT(0)
	) ON [PRIMARY]
    PRINT 'Tao bang vweb_gift_tichluythe thanh cong'
GO

IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[vweb_doingoc]') AND type in (N'U'))
drop table [dbo].[vweb_doingoc]
GO

CREATE TABLE [dbo].[vweb_doingoc] (
		[id] [int] IDENTITY (1, 1) NOT NULL ,
		[acc] [varchar] (10) NOT NULL ,
		[item_code] [varchar] (32) NOT NULL ,
		[item_name] [ntext] NOT NULL ,
		[item_info] [ntext] NULL ,
		[item_serial] [varchar] (8) NOT NULL ,
		[item_image] [varchar] (20) NOT NULL ,
		[giaban] [int] NOT NULL DEFAULT(0),
		[tiente] [varchar] (10) NOT NULL ,
		[time] [int] NOT NULL DEFAULT(0)
) ON [PRIMARY]
PRINT 'Tao bang vweb_doingoc thanh cong'
GO

IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[VWEB_Resets_Log]') AND type in (N'U'))
drop table [dbo].[VWEB_Resets_Log]
GO

CREATE TABLE [dbo].[VWEB_Resets_Log] (
	[acc] [varchar](10) NOT NULL,
	[name] [varchar](50) NOT NULL,
	[Relife] [int] NOT NULL,
	[Resets] [int] NOT NULL,
	[Time] [int] NOT NULL
) ON [PRIMARY]
PRINT 'Tao bang VWeb_DaiLy thanh cong'
GO

IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[VWeb_DaiLy]') AND type in (N'U'))
drop table [dbo].[VWeb_DaiLy]
GO
    CREATE TABLE [VWeb_DaiLy] (
		[acc] [varchar] (10) NOT NULL,
		[gcoin_daily]	[bigint] DEFAULT (0)
	) ON [PRIMARY]
    PRINT 'Tao bang VWeb_DaiLy thanh cong'
GO

IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Log_ModDaiLy]') AND type in (N'U'))
drop table [dbo].[Log_ModDaiLy]
GO

CREATE TABLE [dbo].[Log_ModDaiLy] (
	[acc] [varchar] (10) NOT NULL ,
	[Des] [ntext] NULL ,
	[time] [int] NULL 
) ON [PRIMARY]
PRINT 'Tao bang Log_ModDaiLy thanh cong'
GO

IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[VWEB_Items2Point]') AND type in (N'U'))
drop table [dbo].[VWEB_Items2Point]
GO
    CREATE TABLE [VWEB_Items2Point] (
		[acc] [varchar] (20) NULL ,
		[name] [varchar] (20) NULL ,
		[points] [int] NOT NULL DEFAULT (0) ,
		[slg] [int] NOT NULL DEFAULT (0) ,
		[type] [tinyint] NOT NULL DEFAULT (1) ,
		[time] [smalldatetime] NOT NULL DEFAULT (2013-01-01)
	) ON [PRIMARY]
    PRINT 'Tao bang VWEB_Items2Point thanh cong'
GO

IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Event_TOP_Master2Point]') AND type in (N'U'))
drop table [dbo].[Event_TOP_Master2Point]
GO
    CREATE TABLE [Event_TOP_Master2Point] (
		[acc] [varchar] (20) NULL ,
		[name] [varchar] (20) NULL ,
		[points] [int] NOT NULL DEFAULT (0) ,
		[time] [smalldatetime] NOT NULL DEFAULT (2013-01-01)
	) ON [PRIMARY]
    PRINT 'Tao bang Event_TOP_Master2Point thanh cong'
GO

IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[VWEB_PointEvent_Log]') AND type in (N'U'))
drop table [dbo].[VWEB_PointEvent_Log]
GO
CREATE TABLE [dbo].[VWEB_PointEvent_Log] (
	[acc] [varchar](10) NOT NULL,
	[name] [varchar](50) NOT NULL,
	[point_event] [int] NOT NULL,
	[Time] [int] NOT NULL
) ON [PRIMARY]
PRINT 'Tao bang VWEB_PointEvent_Log thanh cong'
GO

IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[VWEB_DanhHieuThue_Log]') AND type in (N'U'))
drop table [dbo].[VWEB_DanhHieuThue_Log]
GO

CREATE TABLE [dbo].[VWEB_DanhHieuThue_Log] (
	[acc] [varchar](10) NOT NULL,
	[name] [varchar](50) NOT NULL,
	[lop] [varchar](50) NOT NULL,
	[id] [int] NOT NULL,
	[Time] [int] NOT NULL
) ON [PRIMARY]
PRINT 'Tao bang VWEB_DanhHieuThue_Log thanh cong'
GO

IF NOT EXISTS ( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='Dupe_Scan' AND COLUMN_NAME='slgitem' )
BEGIN 
	Alter TABLE Dupe_Scan ADD slgitem tinyint NOT NULL DEFAULT 0
	PRINT 'Da them cot Dupe_Scan.slgitem'
END
ELSE BEGIN PRINT 'Da co cot Dupe_Scan.slgitem' END

IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[vweb_gift_thangcap]') AND type in (N'U'))
drop table [dbo].[vweb_gift_thangcap]
GO
    CREATE TABLE [vweb_gift_thangcap] (
		[acc] [varchar] (10) NOT NULL ,
		[name] [varchar] (10) NOT NULL ,
		[reset_all] [int] NOT NULL DEFAULT(0) ,
		[relife] [int] NOT NULL DEFAULT(0) ,
		[reset] [int] NOT NULL DEFAULT(0) ,
		[level] [int] NOT NULL DEFAULT(0) ,
		[time] [int] NOT NULL DEFAULT(0)
	) ON [PRIMARY]
    PRINT 'Tao bang vweb_gift_thangcap thanh cong'
GO

IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Event_TOP_TieuPhi]') AND type in (N'U'))
drop table [dbo].[Event_TOP_TieuPhi]
GO
    CREATE TABLE [Event_TOP_TieuPhi] (
		[acc] [varchar] (20) NULL ,
		[name] [varchar] (20) NULL ,
		[gcoin] [int] NOT NULL DEFAULT (0) ,
		[gcoin_km] [int] NOT NULL DEFAULT (0) ,
		[vpoint] [int] NOT NULL DEFAULT (0) ,
		[time] [smalldatetime] NOT NULL DEFAULT (2013-01-01)
	) ON [PRIMARY]
    PRINT 'Tao bang Event_TOP_TieuPhi thanh cong'
GO

IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Event_TOP_VongQuay]') AND type in (N'U'))
drop table [dbo].[Event_TOP_VongQuay]
GO
    CREATE TABLE [Event_TOP_VongQuay] (
		[acc] [varchar] (10) NOT NULL ,
		[lanquay] [int] NOT NULL DEFAULT(0) ,
		[time] [smalldatetime] NOT NULL DEFAULT (2013-01-01)
	) ON [PRIMARY]
    PRINT 'Tao bang Event_TOP_VongQuay thanh cong'
GO

IF NOT EXISTS ( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='MEMB_INFO' AND COLUMN_NAME='bank' )
BEGIN 
	Alter TABLE MEMB_INFO ADD bank bigint NOT NULL DEFAULT 0
	PRINT 'Da them cot MEMB_INFO.bank'
END
ELSE BEGIN PRINT 'Da co cot MEMB_INFO.bank' END

IF NOT EXISTS ( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='MEMB_INFO' AND COLUMN_NAME='vpoint' )
BEGIN 
	Alter TABLE MEMB_INFO ADD vpoint bigint NOT NULL DEFAULT 0
	PRINT 'Da them cot MEMB_INFO.vpoint'
END
ELSE BEGIN PRINT 'Da co cot MEMB_INFO.vpoint' END

IF NOT EXISTS ( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='MEMB_INFO' AND COLUMN_NAME='gcoin' )
BEGIN 
	Alter TABLE MEMB_INFO ADD gcoin bigint NOT NULL DEFAULT 0
	PRINT 'Da them cot MEMB_INFO.gcoin'
END
ELSE BEGIN PRINT 'Da co cot MEMB_INFO.gcoin' END

IF NOT EXISTS ( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='MEMB_INFO' AND COLUMN_NAME='gcoin_km' )
BEGIN 
	Alter TABLE MEMB_INFO ADD gcoin_km bigint NOT NULL DEFAULT 0
	PRINT 'Da them cot MEMB_INFO.gcoin_km'
END
ELSE BEGIN PRINT 'Da co cot MEMB_INFO.gcoin_km' END

IF NOT EXISTS ( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='MEMB_INFO' AND COLUMN_NAME='memb__pwd2' )
BEGIN 
	Alter TABLE MEMB_INFO ADD memb__pwd2 varchar(32)
	PRINT 'Da them cot MEMB_INFO.memb__pwd2'
END
ELSE BEGIN PRINT 'Da co cot MEMB_INFO.memb__pwd2' END
Alter TABLE MEMB_INFO Alter COLUMN memb__pwd2 varchar(32)

IF NOT EXISTS ( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='MEMB_INFO' AND COLUMN_NAME='memb__pwdmd5' )
BEGIN 
	Alter TABLE MEMB_INFO ADD memb__pwdmd5 varchar(32)
	PRINT 'Da them cot MEMB_INFO.memb__pwdmd5'
END
ELSE BEGIN PRINT 'Da co cot MEMB_INFO.memb__pwdmd5' END
Alter TABLE MEMB_INFO Alter COLUMN memb__pwdmd5 varchar(32)

IF NOT EXISTS ( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='MEMB_INFO' AND COLUMN_NAME='pass2' )
BEGIN 
	Alter TABLE MEMB_INFO ADD pass2 varchar(32)
	PRINT 'Da them cot MEMB_INFO.pass2'
END
ELSE BEGIN PRINT 'Da co cot MEMB_INFO.pass2' END
Alter TABLE MEMB_INFO Alter COLUMN pass2 varchar(32)

IF NOT EXISTS ( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='MEMB_INFO' AND COLUMN_NAME='jewel_chao' )
BEGIN 
	Alter TABLE MEMB_INFO ADD jewel_chao int NOT NULL DEFAULT 0
	PRINT 'Da them cot MEMB_INFO.jewel_chao'
END
ELSE BEGIN PRINT 'Da co cot MEMB_INFO.jewel_chao' END

IF NOT EXISTS ( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='MEMB_INFO' AND COLUMN_NAME='jewel_cre' )
BEGIN 
	Alter TABLE MEMB_INFO ADD jewel_cre int NOT NULL DEFAULT 0
	PRINT 'Da them cot MEMB_INFO.jewel_cre'
END
ELSE BEGIN PRINT 'Da co cot MEMB_INFO.jewel_cre' END

IF NOT EXISTS ( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='MEMB_INFO' AND COLUMN_NAME='jewel_blue' )
BEGIN 
	Alter TABLE MEMB_INFO ADD jewel_blue int NOT NULL DEFAULT 0
	PRINT 'Da them cot MEMB_INFO.jewel_blue'
END
ELSE BEGIN PRINT 'Da co cot MEMB_INFO.jewel_blue' END

IF NOT EXISTS ( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='MEMB_INFO' AND COLUMN_NAME='passran' )
BEGIN 
	Alter TABLE MEMB_INFO ADD passran tinyint NOT NULL DEFAULT 0
	PRINT 'Da them cot MEMB_INFO.passran'
END
ELSE BEGIN PRINT 'Da co cot MEMB_INFO.passran' END

IF NOT EXISTS ( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='MEMB_INFO' AND COLUMN_NAME='checklogin' )
BEGIN 
	Alter TABLE MEMB_INFO ADD checklogin varchar(50) null
	PRINT 'Da them cot MEMB_INFO.checklogin'
END
ELSE BEGIN PRINT 'Da co cot MEMB_INFO.checklogin' END

IF NOT EXISTS ( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='MEMB_INFO' AND COLUMN_NAME='time_checksms' )
BEGIN 
	Alter TABLE MEMB_INFO ADD time_checksms int NOT NULL DEFAULT 0
	PRINT 'Da them cot MEMB_INFO.time_checksms'
END
ELSE BEGIN PRINT 'Da co cot MEMB_INFO.time_checksms' END

IF NOT EXISTS ( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='MEMB_INFO' AND COLUMN_NAME='checksms_status' )
BEGIN 
	Alter TABLE MEMB_INFO ADD checksms_status tinyint NOT NULL DEFAULT 0
	PRINT 'Da them cot MEMB_INFO.checksms_status'
END
ELSE BEGIN PRINT 'Da co cot MEMB_INFO.checksms_status' END

IF NOT EXISTS ( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='MEMB_INFO' AND COLUMN_NAME='admin_block' )
BEGIN 
	Alter TABLE MEMB_INFO ADD admin_block tinyint NOT NULL DEFAULT 0
	PRINT 'Da them cot MEMB_INFO.admin_block'
END
ELSE BEGIN PRINT 'Da co cot MEMB_INFO.admin_block' END

IF NOT EXISTS ( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='MEMB_INFO' AND COLUMN_NAME='time_reg' )
BEGIN 
	Alter TABLE MEMB_INFO ADD time_reg datetime NOT NULL DEFAULT GetDate()
	PRINT 'Da them cot MEMB_INFO.time_reg'
END
ELSE BEGIN PRINT 'Da co cot MEMB_INFO.time_reg' END

IF NOT EXISTS ( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='MEMB_INFO' AND COLUMN_NAME='ip' )
BEGIN 
	Alter TABLE MEMB_INFO ADD ip varchar(20) NULL
	PRINT 'Da them cot MEMB_INFO.ip'
END
ELSE BEGIN PRINT 'Da co cot MEMB_INFO.ip' END

IF NOT EXISTS ( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='MEMB_INFO' AND COLUMN_NAME='thehe' )
BEGIN 
	Alter TABLE MEMB_INFO ADD thehe tinyint NOT NULL DEFAULT 1
	PRINT 'Da them cot MEMB_INFO.thehe'
END
ELSE BEGIN PRINT 'Da co cot MEMB_INFO.thehe' END

IF NOT EXISTS ( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='MEMB_INFO' AND COLUMN_NAME='BlockTime' )
BEGIN 
	Alter TABLE MEMB_INFO ADD BlockTime int NOT NULL DEFAULT 0
	PRINT 'Da them cot MEMB_INFO.BlockTime'
END
ELSE BEGIN PRINT 'Da co cot MEMB_INFO.BlockTime' END

IF NOT EXISTS ( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='MEMB_INFO' AND COLUMN_NAME='BlockSlg' )
BEGIN 
	Alter TABLE MEMB_INFO ADD BlockSlg int NOT NULL DEFAULT 0
	PRINT 'Da them cot MEMB_INFO.BlockSlg'
END
ELSE BEGIN PRINT 'Da co cot MEMB_INFO.BlockSlg' END

IF NOT EXISTS ( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='MEMB_INFO' AND COLUMN_NAME='IPBonusPoint' )
BEGIN 
	Alter TABLE MEMB_INFO ADD IPBonusPoint int NOT NULL DEFAULT 0
	PRINT 'Da them cot MEMB_INFO.IPBonusPoint'
END
ELSE BEGIN PRINT 'Da co cot MEMB_INFO.IPBonusPoint' END

IF NOT EXISTS ( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='MEMB_INFO' AND COLUMN_NAME='nbb_pl' )
BEGIN 
	Alter TABLE MEMB_INFO ADD nbb_pl int NOT NULL DEFAULT 0
	PRINT 'Da them cot MEMB_INFO.nbb_pl'
END
ELSE BEGIN PRINT 'Da co cot MEMB_INFO.nbb_pl' END

IF NOT EXISTS ( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='MEMB_INFO' AND COLUMN_NAME='jewel_heart' )
BEGIN 
	Alter TABLE MEMB_INFO ADD jewel_heart int NOT NULL DEFAULT 0
	PRINT 'Da them cot MEMB_INFO.jewel_heart'
END
ELSE BEGIN PRINT 'Da co cot MEMB_INFO.jewel_heart' END

IF NOT EXISTS ( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='Character' AND COLUMN_NAME='Resets' )
BEGIN 
	Alter TABLE Character ADD Resets int NOT NULL DEFAULT 0
	PRINT 'Da them cot Character.Resets'
END
ELSE BEGIN PRINT 'Da co cot Character.Resets' END

IF NOT EXISTS ( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='Character' AND COLUMN_NAME='ResetNBB' )
BEGIN 
	Alter TABLE Character ADD ResetNBB int NOT NULL DEFAULT 0
	PRINT 'Da them cot Character.ResetNBB'
END
ELSE BEGIN PRINT 'Da co cot Character.ResetNBB' END

IF NOT EXISTS ( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='Character' AND COLUMN_NAME='ResetVIP' )
BEGIN 
	Alter TABLE Character ADD ResetVIP int NOT NULL DEFAULT 0
	PRINT 'Da them cot Character.ResetVIP'
END
ELSE BEGIN PRINT 'Da co cot Character.ResetVIP' END

IF NOT EXISTS ( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='Character' AND COLUMN_NAME='Resets_Time' )
BEGIN 
	Alter TABLE Character ADD Resets_Time int NOT NULL DEFAULT 0
	PRINT 'Da them cot Character.Resets_Time'
END
ELSE BEGIN PRINT 'Da co cot Character.Resets_Time' END

IF NOT EXISTS ( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='Character' AND COLUMN_NAME='NoResetInDay' )
BEGIN 
	Alter TABLE Character ADD NoResetInDay int NOT NULL DEFAULT 0
	PRINT 'Da them cot Character.NoResetInDay'
END
ELSE BEGIN PRINT 'Da co cot Character.NoResetInDay' END

IF NOT EXISTS ( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='Character' AND COLUMN_NAME='DGT_Time' )
BEGIN 
	Alter TABLE Character ADD DGT_Time int NOT NULL DEFAULT 0
	PRINT 'Da them cot Character.DGT_Time'
END
ELSE BEGIN PRINT 'Da co cot Character.DGT_Time' END

IF NOT EXISTS ( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='Character' AND COLUMN_NAME='reset_total' )
BEGIN 
	Alter TABLE Character ADD reset_total int NOT NULL DEFAULT (0)
	PRINT 'Da them cot Character.reset_total'
END
ELSE BEGIN PRINT 'Da co cot Character.reset_total' END

IF NOT EXISTS ( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='Character' AND COLUMN_NAME='Top50' )
BEGIN 
	Alter TABLE Character ADD Top50 int NOT NULL DEFAULT 0
	PRINT 'Da them cot Character.Top50'
END
ELSE BEGIN PRINT 'Da co cot Character.Top50' END

IF NOT EXISTS ( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='Character' AND COLUMN_NAME='NBB_Resets_0h' )
BEGIN 
	Alter TABLE Character ADD NBB_Resets_0h int NOT NULL DEFAULT 0
	PRINT 'Da them cot Character.NBB_Resets_0h'
END
ELSE BEGIN PRINT 'Da co cot Character.NBB_Resets_0h' END

IF NOT EXISTS ( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='Character' AND COLUMN_NAME='NBB_Relifes_0h' )
BEGIN 
	Alter TABLE Character ADD NBB_Relifes_0h int NOT NULL DEFAULT 0
	PRINT 'Da them cot Character.NBB_Relifes_0h'
END
ELSE BEGIN PRINT 'Da co cot Character.NBB_Relifes_0h' END

IF NOT EXISTS ( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='Character' AND COLUMN_NAME='Relifes' )
BEGIN 
	Alter TABLE Character ADD Relifes int NOT NULL DEFAULT 0
	PRINT 'Da them cot Character.Relifes'
END
ELSE BEGIN PRINT 'Da co cot Character.Relifes' END

IF NOT EXISTS ( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='Character' AND COLUMN_NAME='khoado' )
BEGIN 
	Alter TABLE Character ADD khoado tinyint NOT NULL DEFAULT 0
	PRINT 'Da them cot Character.khoado'
END
ELSE BEGIN PRINT 'Da co cot Character.khoado' END

IF NOT EXISTS ( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='Character' AND COLUMN_NAME='makhoado' )
BEGIN 
	Alter TABLE Character ADD makhoado varchar(50)
	PRINT 'Da them cot Character.makhoado'
END
ELSE BEGIN PRINT 'Da co cot Character.makhoado' END

IF NOT EXISTS ( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='Character' AND COLUMN_NAME='IsThuePoint' )
BEGIN 
	Alter TABLE Character ADD IsThuePoint tinyint NOT NULL DEFAULT 0
	PRINT 'Da them cot Character.IsThuePoint'
END
ELSE BEGIN PRINT 'Da co cot Character.IsThuePoint' END

IF NOT EXISTS ( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='Character' AND COLUMN_NAME='TimeThuePoint' )
BEGIN 
	Alter TABLE Character ADD TimeThuePoint int NOT NULL DEFAULT 0
	PRINT 'Da them cot Character.TimeThuePoint'
END
ELSE BEGIN PRINT 'Da co cot Character.TimeThuePoint' END

IF NOT EXISTS ( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='Character' AND COLUMN_NAME='PointThue' )
BEGIN 
	Alter TABLE Character ADD PointThue int NOT NULL DEFAULT 0
	PRINT 'Da them cot Character.PointThue'
END
ELSE BEGIN PRINT 'Da co cot Character.PointThue' END

IF NOT EXISTS ( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='Character' AND COLUMN_NAME='ErrorSubBlock' )
BEGIN 
	Alter TABLE Character ADD ErrorSubBlock tinyint NOT NULL DEFAULT 0
	PRINT 'Da them cot Character.ErrorSubBlock'
END
ELSE BEGIN PRINT 'Da co cot Character.ErrorSubBlock' END

IF NOT EXISTS ( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='Character' AND COLUMN_NAME='pointdutru' )
BEGIN 
	Alter TABLE Character ADD pointdutru int NOT NULL DEFAULT 0
	PRINT 'Da them cot Character.pointdutru'
END
ELSE BEGIN PRINT 'Da co cot Character.pointdutru' END

IF NOT EXISTS ( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='Character' AND COLUMN_NAME='UyThac' )
BEGIN 
	Alter TABLE Character ADD UyThac tinyint NOT NULL DEFAULT 0
	PRINT 'Da them cot Character.UyThac'
END
ELSE BEGIN PRINT 'Da co cot Character.UyThac' END

IF NOT EXISTS ( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='Character' AND COLUMN_NAME='uythacoffline_stat' )
BEGIN 
	Alter TABLE Character ADD uythacoffline_stat int NOT NULL DEFAULT 0
	PRINT 'Da them cot Character.uythacoffline_stat'
END
ELSE BEGIN PRINT 'Da co cot Character.uythacoffline_stat' END

IF NOT EXISTS ( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='Character' AND COLUMN_NAME='uythacoffline_time' )
BEGIN 
	Alter TABLE Character ADD uythacoffline_time int NOT NULL DEFAULT 0
	PRINT 'Da them cot Character.uythacoffline_time'
END
ELSE BEGIN PRINT 'Da co cot Character.uythacoffline_time' END

IF NOT EXISTS ( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='Character' AND COLUMN_NAME='UyThacOffline_Daily' )
BEGIN 
	Alter TABLE Character ADD UyThacOffline_Daily int NOT NULL DEFAULT 0
	PRINT 'Da them cot Character.UyThacOffline_Daily'
END
ELSE BEGIN PRINT 'Da co cot Character.UyThacOffline_Daily' END

IF NOT EXISTS ( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='Character' AND COLUMN_NAME='PointUyThac' )
BEGIN 
	Alter TABLE Character ADD PointUyThac int NOT NULL DEFAULT 0
	PRINT 'Da them cot Character.PointUyThac'
END
ELSE BEGIN PRINT 'Da co cot Character.PointUyThac' END

IF NOT EXISTS ( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='Character' AND COLUMN_NAME='PointUyThac_Event' )
BEGIN 
	Alter TABLE Character ADD PointUyThac_Event bigint NOT NULL DEFAULT 0
	PRINT 'Da them cot Character.PointUyThac_Event'
END
ELSE BEGIN PRINT 'Da co cot Character.PointUyThac_Event' END

IF NOT EXISTS ( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='Character' AND COLUMN_NAME='Onlinetime' )
BEGIN 
	Alter TABLE Character ADD Onlinetime int NOT NULL DEFAULT 0
	PRINT 'Da them cot Character.Onlinetime'
END
ELSE BEGIN PRINT 'Da co cot Character.Onlinetime' END

IF NOT EXISTS ( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='Character' AND COLUMN_NAME='point_event' )
BEGIN 
	Alter TABLE Character ADD point_event int NOT NULL DEFAULT 0
	PRINT 'Da them cot Character.point_event'
END
ELSE BEGIN PRINT 'Da co cot Character.point_event' END

IF NOT EXISTS ( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='Character' AND COLUMN_NAME='event1_type1' )
BEGIN 
	Alter TABLE Character ADD event1_type1 int NOT NULL DEFAULT 0
	PRINT 'Da them cot Character.event1_type1'
END
ELSE BEGIN PRINT 'Da co cot Character.event1_type1' END

IF NOT EXISTS ( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='Character' AND COLUMN_NAME='event1_type2' )
BEGIN 
	Alter TABLE Character ADD event1_type2 int NOT NULL DEFAULT 0
	PRINT 'Da them cot Character.event1_type2'
END
ELSE BEGIN PRINT 'Da co cot Character.event1_type2' END

IF NOT EXISTS ( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='Character' AND COLUMN_NAME='event1_type3' )
BEGIN 
	Alter TABLE Character ADD event1_type3 int NOT NULL DEFAULT 0
	PRINT 'Da them cot Character.event1_type3'
END
ELSE BEGIN PRINT 'Da co cot Character.event1_type3' END

IF NOT EXISTS ( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='Event_TOP_RS' AND COLUMN_NAME='reset_score' )
BEGIN 
	Alter TABLE Event_TOP_RS ADD reset_score [int] NOT NULL DEFAULT (0)
	PRINT 'Da them cot Event_TOP_RS.reset_score'
END
ELSE BEGIN PRINT 'Da co cot Event_TOP_RS.reset_score' END

IF NOT EXISTS ( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='Event_TOP_RS' AND COLUMN_NAME='time' )
BEGIN 
	Alter TABLE Event_TOP_RS ADD [time] [smalldatetime] NOT NULL DEFAULT (2013-01-01)
	PRINT 'Da them cot Event_TOP_RS.time'
END
ELSE BEGIN PRINT 'Da co cot Event_TOP_RS.time' END

IF NOT EXISTS ( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='Event_TOP_Point' AND COLUMN_NAME='slg' )
BEGIN 
	Alter TABLE Event_TOP_Point ADD slg [int] NOT NULL DEFAULT (0)
	PRINT 'Da them cot Event_TOP_Point.slg'
END
ELSE BEGIN PRINT 'Da co cot Event_TOP_Point.slg' END

IF NOT EXISTS ( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='Event_TOP_Point' AND COLUMN_NAME='type' )
BEGIN 
	Alter TABLE Event_TOP_Point ADD [type] [tinyint] NOT NULL DEFAULT (1)
	PRINT 'Da them cot Event_TOP_Point.type'
END
ELSE BEGIN PRINT 'Da co cot Event_TOP_Point.type' END

IF NOT EXISTS ( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='Event_TOP_Point' AND COLUMN_NAME='time' )
BEGIN 
	Alter TABLE Event_TOP_Point ADD [time] [smalldatetime] NOT NULL DEFAULT (2013-01-01)
	PRINT 'Da them cot Event_TOP_Point.time'
END
ELSE BEGIN PRINT 'Da co cot Event_TOP_Point.time' END

IF NOT EXISTS ( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='Event_TOP_Card' AND COLUMN_NAME='time' )
BEGIN 
	Alter TABLE Event_TOP_Card ADD [time] [smalldatetime] NOT NULL DEFAULT (2013-01-01)
	PRINT 'Da them cot Event_TOP_Card.time'
END
ELSE BEGIN PRINT 'Da co cot Event_TOP_Card.time' END

IF NOT EXISTS ( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='DauGia_Item' AND COLUMN_NAME='itempass' )
BEGIN 
	Alter TABLE DauGia_Item ADD itempass varchar (10) NULL
	PRINT 'Da them cot DauGia_Item.itempass'
END
ELSE BEGIN PRINT 'Da co cot DauGia_Item.itempass' END

IF NOT EXISTS ( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='DauGia_Item' AND COLUMN_NAME='trade_safe' )
BEGIN 
	Alter TABLE DauGia_Item ADD trade_safe tinyint NOT NULL DEFAULT 0
	PRINT 'Da them cot DauGia_Item.trade_safe'
END
ELSE BEGIN PRINT 'Da co cot DauGia_Item.trade_safe' END

IF NOT EXISTS ( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='TopReset' AND COLUMN_NAME='resetvip' )
BEGIN 
	Alter TABLE TopReset ADD resetvip int NOT NULL DEFAULT 0
	PRINT 'Da them cot TopReset.resetvip'
END
ELSE BEGIN PRINT 'Da co cot TopReset.resetvip' END

IF NOT EXISTS ( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='TopReset' AND COLUMN_NAME='reset_pri' )
BEGIN 
	Alter TABLE TopReset ADD reset_pri int NOT NULL DEFAULT 0
	PRINT 'Da them cot TopReset.reset_pri'
END
ELSE BEGIN PRINT 'Da co cot TopReset.reset_pri' END

IF NOT EXISTS ( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='TopReset' AND COLUMN_NAME='reset_all' )
BEGIN 
	Alter TABLE TopReset ADD reset_all int NOT NULL DEFAULT 0
	PRINT 'Da them cot TopReset.reset_all'
END
ELSE BEGIN PRINT 'Da co cot TopReset.reset_all' END

IF NOT EXISTS ( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='TopReset' AND COLUMN_NAME='Time_Created' )
BEGIN 
	Alter TABLE TopReset ADD Time_Created smalldatetime NOT NULL DEFAULT GETDATE()
	PRINT 'Da them cot TopReset.Time_Created'
END
ELSE BEGIN PRINT 'Da co cot TopReset.Time_Created' END

IF NOT EXISTS ( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='TopResetScore' AND COLUMN_NAME='reset_score_pri' )
BEGIN 
	Alter TABLE TopResetScore ADD reset_score_pri int NOT NULL DEFAULT 0
	PRINT 'Da them cot TopResetScore.reset_score_pri'
END
ELSE BEGIN PRINT 'Da co cot TopResetScore.reset_score_pri' END

IF NOT EXISTS ( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='TopResetScore' AND COLUMN_NAME='Time_Created' )
BEGIN 
	Alter TABLE TopResetScore ADD Time_Created smalldatetime NOT NULL DEFAULT GETDATE()
	PRINT 'Da them cot TopResetScore.Time_Created'
END
ELSE BEGIN PRINT 'Da co cot TopResetScore.Time_Created' END

IF NOT EXISTS ( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='Guild' AND COLUMN_NAME='G_Created' )
BEGIN 
	Alter TABLE Guild ADD G_Created smalldatetime NOT NULL DEFAULT GETDATE()
	PRINT 'Da them cot Guild.G_Created'
END
ELSE BEGIN PRINT 'Da co cot Guild.G_Created' END

IF NOT EXISTS ( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='GuildMember' AND COLUMN_NAME='G_JoinTime' )
BEGIN 
	Alter TABLE GuildMember ADD G_JoinTime smalldatetime NOT NULL DEFAULT GETDATE()
	PRINT 'Da them cot GuildMember.G_JoinTime'
END
ELSE BEGIN PRINT 'Da co cot GuildMember.G_JoinTime' END

IF NOT EXISTS ( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='Guild' AND COLUMN_NAME='G_TopPoint' )
BEGIN 
	Alter TABLE Guild ADD G_TopPoint int NOT NULL DEFAULT (0)
	PRINT 'Da them cot Guild.G_TopPoint'
END
ELSE BEGIN PRINT 'Da co cot Guild.G_TopPoint' END

IF NOT EXISTS ( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='Guild' AND COLUMN_NAME='G_TopRS' )
BEGIN 
	Alter TABLE Guild ADD G_TopRS int NOT NULL DEFAULT (0)
	PRINT 'Da them cot Guild.G_TopRS'
END
ELSE BEGIN PRINT 'Da co cot Guild.G_TopRS' END

IF NOT EXISTS ( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='Guild' AND COLUMN_NAME='G_TopMem' )
BEGIN 
	Alter TABLE Guild ADD G_TopMem int NOT NULL DEFAULT (0)
	PRINT 'Da them cot Guild.G_TopMem'
END
ELSE BEGIN PRINT 'Da co cot Guild.G_TopMem' END

IF NOT EXISTS ( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='Guild' AND COLUMN_NAME='G_PointTotal' )
BEGIN 
	Alter TABLE Guild ADD G_PointTotal int NOT NULL DEFAULT (0)
	PRINT 'Da them cot Guild.G_PointTotal'
END
ELSE BEGIN PRINT 'Da co cot Guild.G_PointTotal' END

IF NOT EXISTS ( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='Guild' AND COLUMN_NAME='G_SlgMem' )
BEGIN 
	Alter TABLE Guild ADD G_SlgMem int NOT NULL DEFAULT (0)
	PRINT 'Da them cot Guild.G_SlgMem'
END
ELSE BEGIN PRINT 'Da co cot Guild.G_SlgMem' END

IF NOT EXISTS ( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='Guild' AND COLUMN_NAME='G_RSTotal' )
BEGIN 
	Alter TABLE Guild ADD G_RSTotal int NOT NULL DEFAULT (0)
	PRINT 'Da them cot Guild.G_RSTotal'
END
ELSE BEGIN PRINT 'Da co cot Guild.G_RSTotal' END

IF NOT EXISTS ( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='Guild' AND COLUMN_NAME='G_RSYesterday' )
BEGIN 
	Alter TABLE Guild ADD G_RSYesterday int NOT NULL DEFAULT (0)
	PRINT 'Da them cot Guild.G_RSYesterday'
END
ELSE BEGIN PRINT 'Da co cot Guild.G_RSYesterday' END

IF NOT EXISTS ( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='Guild' AND COLUMN_NAME='time_update_rsyesterday' )
BEGIN 
	Alter TABLE Guild ADD time_update_rsyesterday int NOT NULL DEFAULT (0)
	PRINT 'Da them cot Guild.time_update_rsyesterday'
END
ELSE BEGIN PRINT 'Da co cot Guild.time_update_rsyesterday' END

IF NOT EXISTS ( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='DauGia_Bid' AND COLUMN_NAME='bid_gcoin' )
BEGIN 
	Alter TABLE DauGia_Bid ADD bid_gcoin bigint NOT NULL DEFAULT (0)
	PRINT 'Da them cot DauGia_Bid.bid_gcoin'
END
ELSE BEGIN PRINT 'Da co cot DauGia_Bid.bid_gcoin' END
GO

IF NOT EXISTS ( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='DauGiaNguoc_Bid' AND COLUMN_NAME='bid_gcoin' )
BEGIN 
	Alter TABLE DauGiaNguoc_Bid ADD bid_gcoin bigint NOT NULL DEFAULT (0)
	PRINT 'Da them cot DauGiaNguoc_Bid.bid_gcoin'
END
ELSE BEGIN PRINT 'Da co cot DauGiaNguoc_Bid.bid_gcoin' END
GO

IF NOT EXISTS ( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='JBKhoa_VWebMU' AND COLUMN_NAME='landao' )
BEGIN 
	Alter TABLE JBKhoa_VWebMU ADD landao int NOT NULL DEFAULT (0)
	PRINT 'Da them cot JBKhoa_VWebMU.landao'
END
ELSE BEGIN PRINT 'Da co cot JBKhoa_VWebMU.landao' END
GO

IF NOT EXISTS ( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='JBKhoa_VWebMU' AND COLUMN_NAME='year' )
BEGIN 
	ALTER TABLE [dbo].[JBKhoa_VWebMU] ADD  DEFAULT ((2016)) FOR [year]
	PRINT 'Da them cot JBKhoa_VWebMU.year'
END
ELSE BEGIN PRINT 'Da co cot JBKhoa_VWebMU.year' END
GO

IF NOT EXISTS ( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='JBKhoa_VWebMU' AND COLUMN_NAME='month' )
BEGIN 
	ALTER TABLE [dbo].[JBKhoa_VWebMU] ADD  DEFAULT ((1)) FOR [month]
	PRINT 'Da them cot JBKhoa_VWebMU.month'
END
ELSE BEGIN PRINT 'Da co cot JBKhoa_VWebMU.month' END
GO

IF NOT EXISTS ( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='JBKhoa_VWebMU' AND COLUMN_NAME='day' )
BEGIN 
	ALTER TABLE [dbo].[JBKhoa_VWebMU] ADD  DEFAULT ((1)) FOR [day]
	PRINT 'Da them cot JBKhoa_VWebMU.day'
END
ELSE BEGIN PRINT 'Da co cot JBKhoa_VWebMU.day' END
GO

IF NOT EXISTS ( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='JBKhoa_VWebMU' AND COLUMN_NAME='time' )
BEGIN 
	ALTER TABLE [dbo].[JBKhoa_VWebMU] ADD  DEFAULT ((0)) FOR [time]
	PRINT 'Da them cot JBKhoa_VWebMU.time'
END
ELSE BEGIN PRINT 'Da co cot JBKhoa_VWebMU.time' END
GO

IF NOT EXISTS ( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='MEMB_INFO' AND COLUMN_NAME='JBKhoa' )
BEGIN 
	Alter TABLE MEMB_INFO ADD JBKhoa int NOT NULL DEFAULT (0)
	PRINT 'Da them cot MEMB_INFO.JBKhoa'
END
ELSE BEGIN PRINT 'Da co cot MEMB_INFO.JBKhoa' END
GO

IF NOT EXISTS ( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='MEMB_INFO' AND COLUMN_NAME='vweb_warehouse_safe_extra' )
BEGIN 
	Alter TABLE MEMB_INFO ADD vweb_warehouse_safe_extra int NOT NULL DEFAULT (0)
	PRINT 'Da them cot MEMB_INFO.vweb_warehouse_safe_extra'
END
ELSE BEGIN PRINT 'Da co cot MEMB_INFO.vweb_warehouse_safe_extra' END
GO

IF NOT EXISTS ( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='Character' AND COLUMN_NAME='Resets_Time_0h' )
BEGIN 
	Alter TABLE Character ADD Resets_Time_0h int NOT NULL DEFAULT (0)
	PRINT 'Da them cot Character.Resets_Time_0h'
END
ELSE BEGIN PRINT 'Da co cot Character.Resets_Time_0h' END
GO

IF NOT EXISTS ( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='MEMB_INFO' AND COLUMN_NAME='baoveaccip' )
BEGIN 
	Alter TABLE MEMB_INFO ADD baoveaccip varchar (15) NOT NULL DEFAULT (0)
	PRINT 'Da them cot MEMB_INFO.baoveaccip'
END
ELSE BEGIN PRINT 'Da co cot MEMB_INFO.baoveaccip' END
GO

IF NOT EXISTS ( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='memb_info' AND COLUMN_NAME='LanQuayItem' )
BEGIN 
	Alter TABLE memb_info ADD LanQuayItem int NOT NULL DEFAULT (0)
	PRINT 'Da them cot memb_info.LanQuayItem'
END
ELSE BEGIN PRINT 'Da co cot memb_info.LanQuayItem' END
GO

IF NOT EXISTS ( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='memb_info' AND COLUMN_NAME='GHRS_VongQuay' )
BEGIN 
	Alter TABLE memb_info ADD GHRS_VongQuay int NOT NULL DEFAULT (0)
	PRINT 'Da them cot memb_info.GHRS_VongQuay'
END
ELSE BEGIN PRINT 'Da co cot memb_info.GHRS_VongQuay' END
GO

IF NOT EXISTS ( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='Character' AND COLUMN_NAME='master2point' )
BEGIN 
	Alter TABLE Character ADD master2point int NOT NULL DEFAULT (0)
	PRINT 'Da them cot Character.master2point'
END
ELSE BEGIN PRINT 'Da co cot Character.master2point' END
GO

IF NOT EXISTS ( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='MEMB_INFO' AND COLUMN_NAME='vipvweb' )
BEGIN 
	Alter TABLE MEMB_INFO ADD vipvweb int NOT NULL DEFAULT (0)
	PRINT 'Da them cot MEMB_INFO.vipvweb'
END
ELSE BEGIN PRINT 'Da co cot MEMB_INFO.vipvweb' END
GO

IF NOT EXISTS ( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='MEMB_INFO' AND COLUMN_NAME='kimcuongvweb' )
BEGIN 
	Alter TABLE MEMB_INFO ADD kimcuongvweb int NOT NULL DEFAULT (0)
	PRINT 'Da them cot MEMB_INFO.kimcuongvweb'
END
ELSE BEGIN PRINT 'Da co cot MEMB_INFO.kimcuongvweb' END
GO

IF NOT EXISTS ( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='TopReset' AND COLUMN_NAME='reset_uythac' )
BEGIN 
	Alter TABLE TopReset ADD reset_uythac int NOT NULL DEFAULT 0
	PRINT 'Da them cot TopReset.reset_uythac'
END
ELSE BEGIN PRINT 'Da co cot TopReset.reset_uythac' END

IF NOT EXISTS ( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='Character' AND COLUMN_NAME='vweb_pointsave_str' )
BEGIN 
	Alter TABLE Character ADD vweb_pointsave_str int NOT NULL DEFAULT (0)
	PRINT 'Da them cot Character.vweb_pointsave_str'
END
ELSE BEGIN PRINT 'Da co cot Character.vweb_pointsave_str' END
GO

IF NOT EXISTS ( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='Character' AND COLUMN_NAME='vweb_pointsave_agi' )
BEGIN 
	Alter TABLE Character ADD vweb_pointsave_agi int NOT NULL DEFAULT (0)
	PRINT 'Da them cot Character.vweb_pointsave_agi'
END
ELSE BEGIN PRINT 'Da co cot Character.vweb_pointsave_agi' END
GO

IF NOT EXISTS ( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='Character' AND COLUMN_NAME='vweb_pointsave_vit' )
BEGIN 
	Alter TABLE Character ADD vweb_pointsave_vit int NOT NULL DEFAULT (0)
	PRINT 'Da them cot Character.vweb_pointsave_vit'
END
ELSE BEGIN PRINT 'Da co cot Character.vweb_pointsave_vit' END
GO

IF NOT EXISTS ( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='Character' AND COLUMN_NAME='vweb_pointsave_ene' )
BEGIN 
	Alter TABLE Character ADD vweb_pointsave_ene int NOT NULL DEFAULT (0)
	PRINT 'Da them cot Character.vweb_pointsave_ene'
END
ELSE BEGIN PRINT 'Da co cot Character.vweb_pointsave_ene' END
GO

IF NOT EXISTS ( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='MEMB_INFO' AND COLUMN_NAME='vipvweb_type' )
BEGIN 
	Alter TABLE MEMB_INFO ADD vipvweb_type int NOT NULL DEFAULT (0)
	PRINT 'Da them cot MEMB_INFO.vipvweb_type'
END
ELSE BEGIN PRINT 'Da co cot MEMB_INFO.vipvweb_type' END
GO

IF NOT EXISTS ( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='MEMB_INFO' AND COLUMN_NAME='jewel_hhht' )
BEGIN 
	Alter TABLE MEMB_INFO ADD jewel_hhht int NOT NULL DEFAULT 0
	PRINT 'Da them cot MEMB_INFO.jewel_hhht'
END
ELSE BEGIN PRINT 'Da co cot MEMB_INFO.jewel_hhht' END

IF NOT EXISTS ( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='CardPhone' AND COLUMN_NAME='transaction_code' )
BEGIN 
	Alter TABLE CardPhone ADD transaction_code char(36) NULL DEFAULT 0
	PRINT 'Da them cot CardPhone.transaction_code'
END
ELSE BEGIN PRINT 'Da co cot CardPhone.transaction_code' END
GO

IF NOT EXISTS ( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='TopReset' AND COLUMN_NAME='reset_over' )
BEGIN 
	Alter TABLE TopReset ADD reset_over int NOT NULL DEFAULT 0
	PRINT 'Da them cot TopReset.reset_over'
END
ELSE BEGIN PRINT 'Da co cot TopReset.reset_over' END

IF NOT EXISTS ( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='TopReset' AND COLUMN_NAME='reset_day' )
BEGIN 
	Alter TABLE TopReset ADD reset_day int NOT NULL DEFAULT 0
	PRINT 'Da them cot TopReset.reset_day'
END
ELSE BEGIN PRINT 'Da co cot TopReset.reset_day' END

IF NOT EXISTS ( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='Character' AND COLUMN_NAME='vweb_gpoint' )
BEGIN 
	Alter TABLE Character ADD vweb_gpoint int NOT NULL DEFAULT 0
	PRINT 'Da them cot Character.vweb_gpoint'
END
ELSE BEGIN PRINT 'Da co cot Character.vweb_gpoint' END

IF NOT EXISTS ( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='Guild' AND COLUMN_NAME='G_TopScore' )
BEGIN 
	Alter TABLE Guild ADD G_TopScore int NOT NULL DEFAULT (0)
	PRINT 'Da them cot Guild.G_TopScore'
END
ELSE BEGIN PRINT 'Da co cot Guild.G_TopScore' END

IF NOT EXISTS ( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='Character' AND COLUMN_NAME='vweb_pointtotal' )
BEGIN 
	Alter TABLE Character ADD vweb_pointtotal int NOT NULL DEFAULT 0
	PRINT 'Da them cot Character.vweb_pointtotal'
END
ELSE BEGIN PRINT 'Da co cot Character.vweb_pointtotal' END

IF NOT EXISTS ( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='Guild' AND COLUMN_NAME='G_TieuPhi' )
BEGIN 
	Alter TABLE Guild ADD G_TieuPhi int NOT NULL DEFAULT (0)
	PRINT 'Da them cot Guild.G_TieuPhi'
END
ELSE BEGIN PRINT 'Da co cot Guild.G_TieuPhi' END

IF NOT EXISTS ( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='Guild' AND COLUMN_NAME='G_TopTieuPhi' )
BEGIN 
	Alter TABLE Guild ADD G_TopTieuPhi int NOT NULL DEFAULT (0)
	PRINT 'Da them cot Guild.G_TopTieuPhi'
END
ELSE BEGIN PRINT 'Da co cot Guild.G_TopTieuPhi' END
