
CREATE TABLE [AdminList] (
	[UID] [int] NOT NULL ,
	[Level] [smallint] NULL CONSTRAINT [DF__AdminList__Level__150615B5] DEFAULT (0),
	[IP_S] [varchar] (16)  NULL ,
	[IP_E] [varchar] (16)  NULL ,
	 PRIMARY KEY  CLUSTERED 
	(
		[UID]
	)   
) 
GO

CREATE TABLE [CharInfo_1] (
	[UID] [int] NOT NULL ,
	[Name] [varchar] (16)  NULL ,
	[Sex] [tinyint] NULL CONSTRAINT [DF__CharInfo_1__Sex__7C6F7215] DEFAULT (0),
	[Hair] [tinyint] NULL CONSTRAINT [DF__CharInfo_1__Hair__7D63964E] DEFAULT (0),
	[Face] [tinyint] NULL CONSTRAINT [DF__CharInfo_1__Face__7E57BA87] DEFAULT (0),
	[Nationality] [tinyint] NULL CONSTRAINT [DF__CharInfo___Natio__7F4BDEC0] DEFAULT (0),
	[Class] [smallint] NULL CONSTRAINT [DF__CharInfo___Class__004002F9] DEFAULT (1),
	[Fame] [int] NULL CONSTRAINT [DF__CharInfo___Merit__01342732] DEFAULT (0),
	[Mileage] [int] NULL CONSTRAINT [DF__CharInfo_1__Fame__02284B6B] DEFAULT (0),
	[Guild] [int] NULL CONSTRAINT [DF__CharInfo___Guild__031C6FA4] DEFAULT (0),
	[Party] [int] NULL CONSTRAINT [DF__CharInfo___Party__041093DD] DEFAULT (0),
	[Level] [tinyint] NULL CONSTRAINT [DF__CharInfo___Level__0504B816] DEFAULT (1),
	[Equip] [binary] (30) NULL ,
	[Gold] [int] NULL ,
	[IP] [smallint] NULL CONSTRAINT [DF__CharInfo_1__IP__05F8DC4F] DEFAULT (0),
	[STR] [smallint] NULL CONSTRAINT [DF__CharInfo_1__STR__06ED0088] DEFAULT (0),
	[DEX] [smallint] NULL CONSTRAINT [DF__CharInfo_1__DEX__07E124C1] DEFAULT (0),
	[CON] [smallint] NULL CONSTRAINT [DF__CharInfo_1__CON__08D548FA] DEFAULT (0),
	[Intell] [smallint] NULL CONSTRAINT [DF__CharInfo___Intel__09C96D33] DEFAULT (0),
	[WIS] [smallint] NULL CONSTRAINT [DF__CharInfo_1__WIS__0ABD916C] DEFAULT (0),
	[HP] [smallint] NULL CONSTRAINT [DF__CharInfo_1__HP__0BB1B5A5] DEFAULT (0),
	[MP] [smallint] NULL CONSTRAINT [DF__CharInfo_1__MP__0CA5D9DE] DEFAULT (0),
	[Exp] [bigint] NULL CONSTRAINT [DF__CharInfo_1__Exp__0D99FE17] DEFAULT (0),
	[Chance] [tinyint] NULL CONSTRAINT [DF__CharInfo___Chanc__7CF981FA] DEFAULT (0),
	CONSTRAINT [PK__CharInfo_1__7A8729A3] PRIMARY KEY  CLUSTERED 
	(
		[UID]
	) ,
	CONSTRAINT [CK__CharInfo_1__UID__7B7B4DDC] CHECK ([UID] % 4 = 0)
) 
GO


CREATE TABLE [CharInfo_2] (
	[UID] [int] NOT NULL ,
	[Name] [varchar] (16)  NULL ,
	[Sex] [tinyint] NULL CONSTRAINT [DF__CharInfo_2__Sex__116A8EFB] DEFAULT (0),
	[Hair] [tinyint] NULL CONSTRAINT [DF__CharInfo_2__Hair__125EB334] DEFAULT (0),
	[Face] [tinyint] NULL CONSTRAINT [DF__CharInfo_2__Face__1352D76D] DEFAULT (0),
	[Nationality] [tinyint] NULL CONSTRAINT [DF__CharInfo___Natio__1446FBA6] DEFAULT (0),
	[Class] [smallint] NULL CONSTRAINT [DF__CharInfo___Class__153B1FDF] DEFAULT (1),
	[Fame] [int] NULL CONSTRAINT [DF__CharInfo___Merit__162F4418] DEFAULT (0),
	[Mileage] [int] NULL CONSTRAINT [DF__CharInfo_2__Fame__17236851] DEFAULT (0),
	[Guild] [int] NULL CONSTRAINT [DF__CharInfo___Guild__18178C8A] DEFAULT (0),
	[Party] [int] NULL CONSTRAINT [DF__CharInfo___Party__190BB0C3] DEFAULT (0),
	[Level] [tinyint] NULL CONSTRAINT [DF__CharInfo___Level__19FFD4FC] DEFAULT (1),
	[Equip] [binary] (30) NULL ,
	[Gold] [int] NULL ,
	[IP] [smallint] NULL CONSTRAINT [DF__CharInfo_2__IP__1AF3F935] DEFAULT (0),
	[STR] [smallint] NULL CONSTRAINT [DF__CharInfo_2__STR__1BE81D6E] DEFAULT (0),
	[DEX] [smallint] NULL CONSTRAINT [DF__CharInfo_2__DEX__1CDC41A7] DEFAULT (0),
	[CON] [smallint] NULL CONSTRAINT [DF__CharInfo_2__CON__1DD065E0] DEFAULT (0),
	[Intell] [smallint] NULL CONSTRAINT [DF__CharInfo___Intel__1EC48A19] DEFAULT (0),
	[WIS] [smallint] NULL CONSTRAINT [DF__CharInfo_2__WIS__1FB8AE52] DEFAULT (0),
	[HP] [smallint] NULL CONSTRAINT [DF__CharInfo_2__HP__20ACD28B] DEFAULT (0),
	[MP] [smallint] NULL CONSTRAINT [DF__CharInfo_2__MP__21A0F6C4] DEFAULT (0),
	[Exp] [bigint] NULL CONSTRAINT [DF__CharInfo_2__Exp__22951AFD] DEFAULT (0),
	[Chance] [tinyint] NULL CONSTRAINT [DF__CharInfo___Chanc__7DEDA633] DEFAULT (0),
	CONSTRAINT [PK__CharInfo_2__0F824689] PRIMARY KEY  CLUSTERED 
	(
		[UID]
	)  ,
	CONSTRAINT [CK__CharInfo_2__UID__10766AC2] CHECK ([UID] % 4 = 1)
)
GO

CREATE TABLE [CharInfo_3] (
	[UID] [int] NOT NULL ,
	[Name] [varchar] (16)  NULL ,
	[Sex] [tinyint] NULL CONSTRAINT [DF__CharInfo_3__Sex__2665ABE1] DEFAULT (0),
	[Hair] [tinyint] NULL CONSTRAINT [DF__CharInfo_3__Hair__2759D01A] DEFAULT (0),
	[Face] [tinyint] NULL CONSTRAINT [DF__CharInfo_3__Face__284DF453] DEFAULT (0),
	[Nationality] [tinyint] NULL CONSTRAINT [DF__CharInfo___Natio__2942188C] DEFAULT (0),
	[Class] [smallint] NULL CONSTRAINT [DF__CharInfo___Class__2A363CC5] DEFAULT (1),
	[Fame] [int] NULL CONSTRAINT [DF__CharInfo___Merit__2B2A60FE] DEFAULT (0),
	[Mileage] [int] NULL CONSTRAINT [DF__CharInfo_3__Fame__2C1E8537] DEFAULT (0),
	[Guild] [int] NULL CONSTRAINT [DF__CharInfo___Guild__2D12A970] DEFAULT (0),
	[Party] [int] NULL CONSTRAINT [DF__CharInfo___Party__2E06CDA9] DEFAULT (0),
	[Level] [tinyint] NULL CONSTRAINT [DF__CharInfo___Level__2EFAF1E2] DEFAULT (1),
	[Equip] [binary] (30) NULL ,
	[Gold] [int] NULL ,
	[IP] [smallint] NULL CONSTRAINT [DF__CharInfo_3__IP__2FEF161B] DEFAULT (0),
	[STR] [smallint] NULL CONSTRAINT [DF__CharInfo_3__STR__30E33A54] DEFAULT (0),
	[DEX] [smallint] NULL CONSTRAINT [DF__CharInfo_3__DEX__31D75E8D] DEFAULT (0),
	[CON] [smallint] NULL CONSTRAINT [DF__CharInfo_3__CON__32CB82C6] DEFAULT (0),
	[Intell] [smallint] NULL CONSTRAINT [DF__CharInfo___Intel__33BFA6FF] DEFAULT (0),
	[WIS] [smallint] NULL CONSTRAINT [DF__CharInfo_3__WIS__34B3CB38] DEFAULT (0),
	[HP] [smallint] NULL CONSTRAINT [DF__CharInfo_3__HP__35A7EF71] DEFAULT (0),
	[MP] [smallint] NULL CONSTRAINT [DF__CharInfo_3__MP__369C13AA] DEFAULT (0),
	[Exp] [bigint] NULL CONSTRAINT [DF__CharInfo_3__Exp__379037E3] DEFAULT (0),
	[Chance] [tinyint] NULL CONSTRAINT [DF__CharInfo___Chanc__7EE1CA6C] DEFAULT (0),
	CONSTRAINT [PK__CharInfo_3__247D636F] PRIMARY KEY  CLUSTERED 
	(
		[UID]
	)   ,
	CONSTRAINT [CK__CharInfo_3__UID__257187A8] CHECK ([UID] % 4 = 2)
) 
GO


CREATE TABLE [CharInfo_4] (
	[UID] [int] NOT NULL ,
	[Name] [varchar] (16)  NULL ,
	[Sex] [tinyint] NULL CONSTRAINT [DF__CharInfo_4__Sex__3B60C8C7] DEFAULT (0),
	[Hair] [tinyint] NULL CONSTRAINT [DF__CharInfo_4__Hair__3C54ED00] DEFAULT (0),
	[Face] [tinyint] NULL CONSTRAINT [DF__CharInfo_4__Face__3D491139] DEFAULT (0),
	[Nationality] [tinyint] NULL CONSTRAINT [DF__CharInfo___Natio__3E3D3572] DEFAULT (0),
	[Class] [smallint] NULL CONSTRAINT [DF__CharInfo___Class__3F3159AB] DEFAULT (1),
	[Fame] [int] NULL CONSTRAINT [DF__CharInfo___Merit__40257DE4] DEFAULT (0),
	[Mileage] [int] NULL CONSTRAINT [DF__CharInfo_4__Fame__4119A21D] DEFAULT (0),
	[Guild] [int] NULL CONSTRAINT [DF__CharInfo___Guild__420DC656] DEFAULT (0),
	[Party] [int] NULL CONSTRAINT [DF__CharInfo___Party__4301EA8F] DEFAULT (0),
	[Level] [tinyint] NULL CONSTRAINT [DF__CharInfo___Level__43F60EC8] DEFAULT (1),
	[Equip] [binary] (30) NULL ,
	[Gold] [int] NULL ,
	[IP] [smallint] NULL CONSTRAINT [DF__CharInfo_4__IP__44EA3301] DEFAULT (0),
	[STR] [smallint] NULL CONSTRAINT [DF__CharInfo_4__STR__45DE573A] DEFAULT (0),
	[DEX] [smallint] NULL CONSTRAINT [DF__CharInfo_4__DEX__46D27B73] DEFAULT (0),
	[CON] [smallint] NULL CONSTRAINT [DF__CharInfo_4__CON__47C69FAC] DEFAULT (0),
	[Intell] [smallint] NULL CONSTRAINT [DF__CharInfo___Intel__48BAC3E5] DEFAULT (0),
	[WIS] [smallint] NULL CONSTRAINT [DF__CharInfo_4__WIS__49AEE81E] DEFAULT (0),
	[HP] [smallint] NULL CONSTRAINT [DF__CharInfo_4__HP__4AA30C57] DEFAULT (0),
	[MP] [smallint] NULL CONSTRAINT [DF__CharInfo_4__MP__4B973090] DEFAULT (0),
	[Exp] [bigint] NULL CONSTRAINT [DF__CharInfo_4__Exp__4C8B54C9] DEFAULT (0),
	[Chance] [tinyint] NULL CONSTRAINT [DF__CharInfo___Chanc__7FD5EEA5] DEFAULT (0),
	CONSTRAINT [PK__CharInfo_4__39788055] PRIMARY KEY  CLUSTERED 
	(
		[UID]
	)   ,
	CONSTRAINT [CK__CharInfo_4__UID__3A6CA48E] CHECK ([UID] % 4 = 3)
) 
GO

CREATE TABLE [CharInfo_Time] (
	[CID] [int] NOT NULL ,
	[CreateTime] [smalldatetime] NULL ,
	[UpdateTime] [smalldatetime] NULL ,
	 PRIMARY KEY  CLUSTERED 
	(
		[CID]
	)   
) 
GO

CREATE TABLE [CharInfoEx] (
	[UID] [int] NOT NULL ,
	[Total] [int] NULL CONSTRAINT [DF__CharInfoE__Total__5CC1BC92] DEFAULT (0),
	[ServerID] [int] NULL CONSTRAINT [DF__CharInfoE__Serve__5DB5E0CB] DEFAULT (0),
	[Config] [binary] (50) NULL ,
	 PRIMARY KEY  CLUSTERED 
	(
		[UID]
	)   
) 
GO
CREATE TABLE [CharItem] (
	[UID] [int] NOT NULL ,
	[Quick] [binary] (40) NULL ,
	[Equip] [binary] (1440) NULL ,
	[Inventory] [binary] (5120) NULL ,
	[Extra] [binary] (512) NULL ,
	 PRIMARY KEY  CLUSTERED 
	(
		[UID]
	)   
) 
GO

CREATE TABLE [CharItemEx] (
	[UID] [int] NOT NULL ,
	[Exchange] [binary] (1284) NULL ,
	 PRIMARY KEY  CLUSTERED 
	(
		[UID]
	)   
) 
GO

CREATE TABLE [CharPos_1] (
	[UID] [int] NOT NULL ,
	[LastPointX] [real] NULL ,
	[LastPointY] [real] NULL ,
	[LastPointZ] [real] NULL ,
	[SavePointX] [real] NULL ,
	[SavePointY] [real] NULL ,
	[SavePointZ] [real] NULL ,
	 PRIMARY KEY  CLUSTERED 
	(
		[UID]
	)   ,
	 CHECK ([UID] % 4 = 0)
) 
GO

CREATE TABLE [CharPos_2] (
	[UID] [int] NOT NULL ,
	[LastPointX] [real] NULL ,
	[LastPointY] [real] NULL ,
	[LastPointZ] [real] NULL ,
	[SavePointX] [real] NULL ,
	[SavePointY] [real] NULL ,
	[SavePointZ] [real] NULL ,
	 PRIMARY KEY  CLUSTERED 
	(
		[UID]
	)   ,
	 CHECK ([UID] % 4 = 1)
) 
GO

CREATE TABLE [CharPos_3] (
	[UID] [int] NOT NULL ,
	[LastPointX] [real] NULL ,
	[LastPointY] [real] NULL ,
	[LastPointZ] [real] NULL ,
	[SavePointX] [real] NULL ,
	[SavePointY] [real] NULL ,
	[SavePointZ] [real] NULL ,
	 PRIMARY KEY  CLUSTERED 
	(
		[UID]
	)   ,
	 CHECK ([UID] % 4 = 2)
) 
GO

CREATE TABLE [CharPos_4] (
	[UID] [int] NOT NULL ,
	[LastPointX] [real] NULL ,
	[LastPointY] [real] NULL ,
	[LastPointZ] [real] NULL ,
	[SavePointX] [real] NULL ,
	[SavePointY] [real] NULL ,
	[SavePointZ] [real] NULL ,
	 PRIMARY KEY  CLUSTERED 
	(
		[UID]
	)   ,
	 CHECK ([UID] % 4 = 3)
) 
GO


CREATE TABLE [CharSkill_1] (
	[UID] [int] NOT NULL ,
	[Skill] [binary] (84) NULL ,
	 PRIMARY KEY  CLUSTERED 
	(
		[UID]
	)   ,
	 CHECK ([UID] % 4 = 0)
) 
GO

CREATE TABLE [CharSkill_2] (
	[UID] [int] NOT NULL ,
	[Skill] [binary] (84) NULL ,
	 PRIMARY KEY  CLUSTERED 
	(
		[UID]
	)   ,
	 CHECK ([UID] % 4 = 1)
) 
GO
CREATE TABLE [CharSkill_3] (
	[UID] [int] NOT NULL ,
	[Skill] [binary] (84) NULL ,
	 PRIMARY KEY  CLUSTERED 
	(
		[UID]
	)   ,
	 CHECK ([UID] % 4 = 2)
) 
GO

CREATE TABLE [CharSkill_4] (
	[UID] [int] NOT NULL ,
	[Skill] [binary] (84) NULL ,
	 PRIMARY KEY  CLUSTERED 
	(
		[UID]
	)   ,
	 CHECK ([UID] % 4 = 3)
) 
GO

CREATE TABLE [CIDStore] (
	[UID] [int] NOT NULL 
) 
GO


CREATE TABLE [Friend] (
	[UID] [int] NOT NULL ,
	[Friend] [binary] (2404) NULL ,
	[Ban] [binary] (2004) NULL ,
	 PRIMARY KEY  CLUSTERED 
	(
		[UID]
	)   
) 
GO
CREATE TABLE [ItemStore1] (
	[UID] [int] NOT NULL ,
	[Password] [char] (5)  NULL CONSTRAINT [DF__ItemStore__Passw__73A521EA] DEFAULT ('0000'),
	[Frag] [int] NULL ,
	[Gold] [int] NULL ,
	[Store] [binary] (7300) NULL ,
	 PRIMARY KEY  CLUSTERED 
	(
		[UID]
	)   
) 
GO

CREATE TABLE [ItemStore2] (
	[UID] [int] NOT NULL ,
	[Store] [binary] (7300) NULL ,
	 PRIMARY KEY  CLUSTERED 
	(
		[UID]
	)   
) 
GO

CREATE TABLE [ItemUID] (
	[Server] [int] NOT NULL ,
	[Item] [bigint] NULL CONSTRAINT [DF__ItemUID__Item__70C8B53F] DEFAULT (0),
	 PRIMARY KEY  CLUSTERED 
	(
		[Server]
	)   
) 
GO

CREATE TABLE [PartyInfo_1] (
	[UID] [int] NOT NULL ,
	[Party] [binary] (200) NULL ,
	 PRIMARY KEY  CLUSTERED 
	(
		[UID]
	)   ,
	 CHECK ([UID] % 4 = 0)
) 
GO

CREATE TABLE [PartyInfo_2] (
	[UID] [int] NOT NULL ,
	[Party] [binary] (200) NULL ,
	 PRIMARY KEY  CLUSTERED 
	(
		[UID]
	)   ,
	 CHECK ([UID] % 4 = 1)
) 
GO


CREATE TABLE [PartyInfo_3] (
	[UID] [int] NOT NULL ,
	[Party] [binary] (200) NULL ,
	 PRIMARY KEY  CLUSTERED 
	(
		[UID]
	)   ,
	 CHECK ([UID] % 4 = 2)
) 
GO

CREATE TABLE [PartyInfo_4] (
	[UID] [int] NOT NULL ,
	[Party] [binary] (200) NULL ,
	 PRIMARY KEY  CLUSTERED 
	(
		[UID]
	)   ,
	 CHECK ([UID] % 4 = 3)
) 
GO

CREATE TABLE [PIDStore] (
	[UID] [int] NOT NULL 
) 
GO

CREATE TABLE [Quest] (
	[UID] [int] NOT NULL ,
	[Quest] [binary] (134) NULL ,
	[History] [binary] (204) NULL ,
	 PRIMARY KEY  CLUSTERED 
	(
		[UID]
	)   
) 
GO


CREATE TABLE [TblCharDelHistory] (
	[intCID] [int] NOT NULL ,
	[intUID] [int] NOT NULL ,
	[dateInsertTime] [smalldatetime] NOT NULL CONSTRAINT [DF__TblCharDe__dateI__0C3BC58A] DEFAULT (getdate()),
	[dateDeleteTime] [smalldatetime] NOT NULL ,
	 PRIMARY KEY  CLUSTERED 
	(
		[intCID]
	)   
) 
GO

CREATE TABLE [TblCharDelHistory_LOG] (
	[intCID] [int] NULL ,
	[intUID] [int] NULL ,
	[dateInsertTime] [smalldatetime] NULL ,
	[dateDeleteTime] [smalldatetime] NULL 
) 
GO

CREATE TABLE [TblEventItem] (
	[nItemIndex] [int] NULL ,
	[strItemName] [varchar] (20)  NULL ,
	[nItemAmount] [int] NULL ,
	[UpdateTime] [smalldatetime] NULL 
) 
GO

CREATE TABLE [TblGuildGold_Log] (
	[nGuildID] [int] NOT NULL ,
	[tInsertTime] [datetime] NOT NULL ,
	[strCharName] [varchar] (20)  NOT NULL ,
	[tnStrengthType] [tinyint] NOT NULL ,
	[snPosition] [smallint] NOT NULL ,
	[tnStrengthLevel] [tinyint] NOT NULL ,
	[nLostGold] [int] NOT NULL ,
	[nGetGold] [int] NOT NULL ,
	[nRemainGold] [int] NOT NULL 
) 
GO


CREATE TABLE [TblGuildInfo] (
	[nGuildID] [int] IDENTITY (10001, 1) NOT NULL ,
	[strGuildName] [varchar] (20)  NOT NULL ,
	[tnGuildLevel] [tinyint] NOT NULL ,
	[nGuildFame] [int] NOT NULL ,
	[nGuildGold] [int] NOT NULL CONSTRAINT [DF__TblGuildI__nGuil__13DCE752] DEFAULT (0),
	[tLastLogout] [smalldatetime] NOT NULL CONSTRAINT [DF__TblGuildI__tLast__14D10B8B] DEFAULT ('2010.12.31'),
	[tCheckMember] [smalldatetime] NOT NULL CONSTRAINT [DF__TblGuildI__tChec__15C52FC4] DEFAULT (getdate()),
	[tGMLastLogout] [smalldatetime] NULL CONSTRAINT [DF__TblGuildI__tGMLa__16B953FD] DEFAULT ('2010.12.31'),
	[bGuildMark] [binary] (433) NULL ,
	[bRight] [binary] (50) NULL ,
	[tnNationType] [tinyint] NULL ,
	 PRIMARY KEY  CLUSTERED 
	(
		[nGuildID]
	)   ,
	CONSTRAINT [uk_TblGuildInfo_strGuildName] UNIQUE  NONCLUSTERED 
	(
		[strGuildName]
	)   ,
	 CHECK ([strGuildName] <> null)
) 
GO
CREATE TABLE [TblGuildItem] (
	[nGuildID] [int] NOT NULL ,
	[bGuildItem] [binary] (7300) NULL ,
	 PRIMARY KEY  CLUSTERED 
	(
		[nGuildID]
	)   ,
	CONSTRAINT [FK_TblGuildInfo_guilditem] FOREIGN KEY 
	(
		[nGuildID]
	) REFERENCES [TblGuildInfo] (
		[nGuildID]
	) ON DELETE CASCADE 
) 
GO
CREATE TABLE [TblGuildItem_EX] (
	[nGuildID] [int] NOT NULL ,
	[bGuildItem] [binary] (7300) NULL ,
	 PRIMARY KEY  CLUSTERED 
	(
		[nGuildID]
	)   ,
	CONSTRAINT [FK_TblGuildInfo_guilditem_ex] FOREIGN KEY 
	(
		[nGuildID]
	) REFERENCES [TblGuildInfo] (
		[nGuildID]
	) ON DELETE CASCADE 
) 
GO

CREATE TABLE [TblGuildItem_log] (
	[nGuildID] [int] NULL ,
	[tInsertTime] [datetime] NULL ,
	[strCharName] [varchar] (20)  NULL ,
	[nItemID] [int] NULL ,
	[nItemType] [int] NULL ,
	[nItemStrengthStep] [int] NULL ,
	[nReason] [int] NULL 
) 
GO

CREATE TABLE [TblGuildMember] (
	[nGuildID] [int] NOT NULL ,
	[nCID] [int] NOT NULL ,
	[nPosition] [int] NOT NULL ,
	[nPositionInGuild] [int] NULL ,
	[tLeaveGuildTime] [smalldatetime] NULL ,
	CONSTRAINT [PK_GuildMember_Guildid_nCid] PRIMARY KEY  CLUSTERED 
	(
		[nGuildID],
		[nCID]
	)   ,
	CONSTRAINT [FK_TblGuildInfo_TblGuildMember] FOREIGN KEY 
	(
		[nGuildID]
	) REFERENCES [TblGuildInfo] (
		[nGuildID]
	) ON DELETE CASCADE 
) 
GO

CREATE TABLE [TblGuildMsg] (
	[nMsgID] [int] IDENTITY (1, 1) NOT NULL ,
	[nGuildID] [int] NOT NULL ,
	[strCharName] [varchar] (20)  NOT NULL ,
	[tInsertTime] [smalldatetime] NOT NULL ,
	[strTitle] [varchar] (60)  NOT NULL ,
	[strMsgType] [varchar] (10)  NULL ,
	[nClass] [int] NULL ,
	[nLevel] [int] NULL ,
	[strContent] [varchar] (4000)  NULL ,
	 PRIMARY KEY  NONCLUSTERED 
	(
		[nMsgID]
	)   ,
	CONSTRAINT [FK_TblGuildInfo_TblGuildMsg] FOREIGN KEY 
	(
		[nGuildID]
	) REFERENCES [TblGuildInfo] (
		[nGuildID]
	) ON DELETE CASCADE 
) 
GO

CREATE TABLE [TblGuildOtherList] (
	[nGuildID] [int] NOT NULL ,
	[nOtherGuildID] [int] NOT NULL ,
	[tnState] [tinyint] NOT NULL ,
	CONSTRAINT [PK_TblGuildOtherList_1] PRIMARY KEY  CLUSTERED 
	(
		[nGuildID],
		[nOtherGuildID]
	)   ,
	CONSTRAINT [FK_TblGuildInfo_TblGuildOtherList] FOREIGN KEY 
	(
		[nGuildID]
	) REFERENCES [TblGuildInfo] (
		[nGuildID]
	) ON DELETE CASCADE ,
	 CHECK ([tnState] = 0 or [tnState] = 1 or [tnState] = 2)
) 
GO


CREATE TABLE [TblGuildRestoreData] (
	[nGuildID] [int] NULL ,
	[strGuildName] [varchar] (20)  NULL ,
	[nGuildGold] [int] NULL ,
	[bGuildItem] [binary] (7300) NULL ,
	[tDeleteTime] [smalldatetime] NULL ,
	[strGuildMName] [varchar] (20) NULL
) 

GO


CREATE TABLE [TblGuildRestoreData_EX] (
	[nGuildID] [int] NULL ,
	[bGuildItem_EX] [binary] (7300) NULL 
) 
GO

CREATE TABLE [UserInfo_1] (
	[UID] [int] NOT NULL ,
	[Char1] [int] NULL ,
	[Char2] [int] NULL ,
	[Char3] [int] NULL ,
	 PRIMARY KEY  CLUSTERED 
	(
		[UID]
	)   ,
	 CHECK ([UID] % 4 = 0)
) 
GO

CREATE TABLE [UserInfo_2] (
	[UID] [int] NOT NULL ,
	[Char1] [int] NULL ,
	[Char2] [int] NULL ,
	[Char3] [int] NULL ,
	 PRIMARY KEY  CLUSTERED 
	(
		[UID]
	)   ,
	 CHECK ([UID] % 4 = 1)
) 
GO


CREATE TABLE [UserInfo_3] (
	[UID] [int] NOT NULL ,
	[Char1] [int] NULL ,
	[Char2] [int] NULL ,
	[Char3] [int] NULL ,
	 PRIMARY KEY  CLUSTERED 
	(
		[UID]
	)   ,
	 CHECK ([UID] % 4 = 2)
) 
GO

CREATE TABLE [UserInfo_4] (
	[UID] [int] NOT NULL ,
	[Char1] [int] NULL ,
	[Char2] [int] NULL ,
	[Char3] [int] NULL ,
	 PRIMARY KEY  CLUSTERED 
	(
		[UID]
	)   ,
	 CHECK ([UID] % 4 = 3)
) 
GO









































