去网上下个动网的系统,分access,sqlserver两个版本.

解决方案 »

  1.   

    --都给你了
    if exists (select * from sysdatabases where name = 'BBS')
    drop database BBScreate database BBS
    on 
    (--主要文件 
      name='BBS_data', 
      filename='d:\project\BBS_data.mdf', 
      size=10mb ) 
    log on--逻辑日志文件 

      name='BBS_log', 
      filename='d:\project\BBS_log.ldf', 
      size=3MB, 
      maxsize = 20mb
     

    USE BBS
     CREATE TABLE BBSUsers
    (
    UID INT not null identity(1,1) primary key,
    UName varchar(32)not null,
    UPassword varchar(16) not null default('8888'),
    UEmail varchar(32) default('[email protected]'),
    UBirthday datetime,
    USex bIT DEFAULT(1) check(USex=1 or USex = 0),
    UClass int default(1),
    UStatement varchar(255),
    URegDate datetime not null,
    UState int default(1),
    UPoint int default(20)
    )
    use BBS
    create table BBSTopic 
    (
    TID INT NOT NULL identity(1,1) primary key,
    TNumber varchar(32) not null,
    TSID INT NOT NULL FOREIGN KEY REFERENCES BBSSession(SID),
    TUID INT NOT NULL FOREIGN KEY REFERENCES BBSUsers(UID),
    TReplyCount int ,
    TEmotion int,
    TTopic varchar(255)not null,
    TContents nText not null,
    TTime datetime,
    TClickCount int ,
    TFlag int not null default(1),
    TLastClickT datetime
    )
    use BBS
    create table BBSReply
    (
    RID INT NOT NULL IDENTITY(1,1) PRIMARY KEY,
    RNumber varchar(32)not null,
    RTID INT NOT NULL FOREIGN KEY REFERENCES BBSTopic(TID),
    RSID INT NOT NULL FOREIGN KEY REFERENCES BBSSession(SID),
    RUID INT NOT NULL FOREIGN KEY REFERENCES BBSUsers(UID),
    REmotion int ,
    RTopic varchar(255)not null,
    RContents NText not null,
    RTime datetime,
    RClickCount INT 
    )
    USE BBS
    CREATE TABLE BBSSession
    (
    SID INT NOT NULL IDENTITY(1,1)PRIMARY KEY,
    SName varchar(255) not null,
    SMasterID int not null foreign key references BBSUsers(UID),
    SStatement VARCHAR(255),
    SClickCount int ,
    STopicCount int 
    )
    use news
    create table tbNews
    (
    id int not null identity(1,1)primary key,
    title varchar(12)not null ,
    author varchar(10)not null,
    content varchar(1000)not null
    )
    create table tbReview
    (
    id int not null identity(1,1)primary key,
    newsId int not null foreign key references tbNews(id),
    title varchar(12)not null ,
    netName varchar(10)not null,
    content varchar(1000)not null
    )
    create table tbAdmin
    (
     id int not null identity(1,1)primary key,
     userName varchar(10)not null,
     pwd varchar(11) not null)
      

  2.   

    use news 
    create table tbNews 
    tbReview 
    tbAdmin 
    他们又是干什么的