create table Board_Re
(
board_idx int IDENTITY(1,1) NOT NULL,
name varchar(20) NOT NULL,
email varchar(50) NULL,
homepage varchar(50) NULL,
title varchar(40) NOT NULL,
pwd varchar(20) NOT NULL,
num int NOT NULL,
writeday varchar(30) NOT NULL,
readnum smallint NOT NULL,
tag varchar(5) NULL,
ref smallint NOT NULL,
re_step smallint NOT NULL,
re_level smallint NOT NULL,
content text NOT NULL
)
CREATE TABLE [dbo].[MyBoard] (
[board_idx] [int] IDENTITY (1, 1) NOT NULL primary key clustered,
[b_name] [varchar] (50) NOT NULL ,
[b_title] [varchar] (50) NOT NULL ,
[b_date] [smalldatetime] NOT NULL default getdate(),
[b_email] [varchar] (100) NULL ,
[b_url] [varchar] (100) NULL ,
[b_readnum] [smallint] NOT NULL default 0,
[b_ipaddr] [varchar] (50) NOT NULL ,
[b_pwd] [varchar] (10) NOT NULL ,
[b_content] [text] NOT NULL
)
GO
ALTER TABLE MyBoard ADD
b_filename VARCHAR(50) NULL,
b_filesize int Default 0
GO
CREATE TABLE [dbo].[Comment] (
[Co_seq] [int] IDENTITY (1, 1) NOT NULL ,
[board_idx] [int] NOT NULL ,
[Co_name] [varchar] (20) NOT NULL ,
[Co_date] [smalldatetime] NOT NULL ,
[Co_Content] [varchar] (500) NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[Comment] WITH NOCHECK ADD
CONSTRAINT [DF_Comment_Co_date] DEFAULT (getdate()) FOR [Co_date],
CONSTRAINT [PK_Comment] PRIMARY KEY CLUSTERED
(
[Co_seq]
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[Comment] ADD
CONSTRAINT [FK_Comment_MyBoard] FOREIGN KEY
(
[board_idx]
) REFERENCES [dbo].[MyBoard] (
[board_idx]
)
GO