这个语句是编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)
)
错误信息为:
服务器: 消息 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)
)
解决方案 »
- 求助关于一条SQL语句的问题
- 求SQL语句,在线等
- 关于备份的问题 高手进来看看
- 局域网内部如何远程访问外网网站服务器数据库?
- 求解。MSSQL一表 怎么插入MYSQL 中的表
- 提问:这个问题值得一百分吗?触发器能不能跨数据库使用,如果不能,该怎么实现相近的功能!
- 请问一下 sql中两个整数相除取余数的函数是什么?
- 请教一个查询问题,在线等!等到10点
- 安装完DB2 for winNT及演示数据库后,如何配置才能用Oledb进行连接。我的 patroller还用不了!!!
- SQL Server 遗留mdf 或Ldf文件导致无法创建数据库
- 如何解决数据库中同一事务的阻塞?
- 读文本块还是读数据库快?
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='女'),---逗号改成半角
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
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列
)