Database/MSSQL2006. 7. 18. 07:14
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[BOARD_1]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[BOARD_1]
GO

CREATE TABLE [dbo].[BOARD_1] (
[Board_num] [int] IDENTITY (1, 1) NOT NULL ,
[Board_Ref] [int] NOT NULL ,
[Board_Step] [int] NOT NULL ,
[Board_RefLevel] [int] NOT NULL ,
[Board_User_id] [varchar] (20) COLLATE Korean_Wansung_CI_AS NOT NULL ,
[Board_pwd] [varchar] (10) COLLATE Korean_Wansung_CI_AS NULL ,
[Board_Email] [varchar] (80) COLLATE Korean_Wansung_CI_AS NULL ,
[Board_IP] [varchar] (20) COLLATE Korean_Wansung_CI_AS NOT NULL ,
[Board_Title] [varchar] (100) COLLATE Korean_Wansung_CI_AS NOT NULL ,
[Board_RegDate] [datetime] NOT NULL ,
[Board_ReadCount] [int] NOT NULL ,
[board_Content] [text] COLLATE Korean_Wansung_CI_AS NOT NULL
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO

ALTER TABLE [dbo].[BOARD_1] WITH NOCHECK ADD
CONSTRAINT [PK_BOARD_1] PRIMARY KEY CLUSTERED
(
[Board_num]
) WITH FILLFACTOR = 90 ON [PRIMARY]
GO

ALTER TABLE [dbo].[BOARD_1] WITH NOCHECK ADD
CONSTRAINT [DF_BOARD_1_Board_Ref] DEFAULT (1) FOR [Board_Ref],
CONSTRAINT [DF_BOARD_1_Board_Step] DEFAULT (1) FOR [Board_Step],
CONSTRAINT [DF_BOARD_1_Board_RefLevel] DEFAULT (0) FOR [Board_RefLevel],
CONSTRAINT [DF_BOARD_1_Board_pwd] DEFAULT ('') FOR [Board_pwd],
CONSTRAINT [DF_BOARD_1_Board_Email] DEFAULT ('') FOR [Board_Email],
CONSTRAINT [DF_BOARD_1_Board_RegDate] DEFAULT (getdate()) FOR [Board_RegDate],
CONSTRAINT [DF_BOARD_1_Board_ReadCount] DEFAULT (0) FOR [Board_ReadCount]
GO

CREATE INDEX [IX_BOARD_1] ON [dbo].[BOARD_1]([Board_User_id]) WITH FILLFACTOR = 90 ON [PRIMARY]
GO

CREATE INDEX [IX_BOARD_1_1] ON [dbo].[BOARD_1]([Board_Title]) WITH FILLFACTOR = 90 ON [PRIMARY]
GO

CREATE INDEX [IX_BOARD_1_2] ON [dbo].[BOARD_1]([Board_Ref], [Board_Step] DESC ) WITH FILLFACTOR = 90 ON [PRIMARY]
GO

CREATE INDEX [IX_BOARD_2] ON [dbo].[BOARD_1]([Board_User_id]) WITH FILLFACTOR = 90 ON [PRIMARY]
GO

CREATE INDEX [IX_BOARD_2_1] ON [dbo].[BOARD_1]([Board_Title]) WITH FILLFACTOR = 90 ON [PRIMARY]
GO

CREATE INDEX [IX_BOARD_2_2] ON [dbo].[BOARD_1]([Board_Ref], [Board_Step] DESC ) WITH FILLFACTOR = 90 ON [PRIMARY]
GO


Posted by BAGE