这个语句是编BBS的开始一点, 但是提示有错误 麻烦谁能帮忙看一下程序到底哪里错了 本人是个初学者麻烦会的老手能指点一下 不胜感激!!
错误信息为:
服务器: 消息 170,级别 15,状态 1,行 6
第 6 行: 'name' 附近有语法错误。
服务器: 消息 911,级别 16,状态 1,行 5
未能在 sysdatabases 中找到数据库 'BBS' 所对应的条目。没有找到具有该名称的条目。请确保正确地输入了名称。
服务器: 消息 170,级别 15,状态 1,行 8
第 8 行: ',' 附近有语法错误。
use master
 go 
if exists(select * from sysdatabases where name='BBS')
  drop database BBS
gocreate database BBS
(
  name='BBS',
  filename='d:\SQL server2000\BBS.mdf',
  size=10,
  filegrowth=2
)log on(
  name='BBS_log',
  filename='d:\SQL server2000\BBS.ldf',
  size=2,
  filegrowth=1
)
go
use BBS
go
create table BBSUser
(
  UID int identity(1,1) primary key,
  UName varchar(20) not null,
  UPassword varchar(8) not null,
  UEmail varchar(20) ,
  UBirthday datetime not null,
  USex char(2) not null default '男' check (USex='男' or USex='女'),
  UClass int default '0',
  UStatement varchar(50),
  URegDate datetime not null,
  UState char(2) not null check(UState='在线' or UState='离线'),
  UPoint int
)create table BBSSession
(
  SID int identity(1,1) primary key,
  SName varchar(20) not null,
  SMasterID int identity(1,1),
  SStatement varchar(50) not null,
  SClickCount int identity(1,1),
  STopicCount int identity(1,1)
)

解决方案 »

  1.   

    create database BBS
    on----这里加上
    (
    name='BBS',---改成name=BBS
    filename='d:\SQL server2000\BBS.mdf',
    size=10,
    filegrowth=2
    )
    USex char(2) not null default '男' check (USex='男' or USex='女'),---逗号改成半角
      

  2.   

    create database BBS
    on primary --加这一句试试
    (
      name='BBS',
      filename='d:\SQL server2000\BBS.mdf',
      size=10,
      filegrowth=2
    )log on(
      name='BBS_log',
      filename='d:\SQL server2000\BBS.ldf',
      size=2,
      filegrowth=1
    )
    go
      

  3.   

    use BBS
    go
    create table BBSUser
    (
      UID int identity(1,1) primary key,
      UName varchar(20) not null,
      UPassword varchar(8) not null,
      UEmail varchar(20) ,
      UBirthday datetime not null,
      USex char(2) not null default '男' check (USex='男' or USex='女'), --应该是半角的逗号
      UClass int default '0',
      UStatement varchar(50),
      URegDate datetime not null,
      UState char(2) not null check(UState='在线' or UState='离线'),
      UPoint int
    )create table BBSSession
    (
      SID int identity(1,1) primary key,
      SName varchar(20) not null,
      SMasterID int, -- 一个表只能有一个identity列
      SStatement varchar(50) not null,
      SClickCount int, -- 一个表只能有一个identity列
      STopicCount int, -- 一个表只能有一个identity列
    )