高手帮我看看,我的SQL Server2005语法错在那里了啊,怎么改呀?

来源:百度知道 编辑:UC知道 时间:2024/05/05 07:49:10
if exists(select * from sysobjects where name='stuDB')
drop table stuDB
go
create table 学员资料
(
字段1 数据类型 列的特征, /*列的特征包括该列是否为空(NULL)、是否是标识列、是否有默认值、是否为主键*/
字段2 数据类型 列的特征, /*列的特征包括该列是否为空(NULL)、是否是标识列、是否有默认值、是否为主键*/
)
create table stuinfo
(
stuName varchar(20) not null, --学员姓名,非空
stuNo char(6) not null, --学号,非空
stuAge int not null, --年龄,Int类型不用指定大小
stuID numeric(18,0), --身份证号,Numeric(18,0)代表18位数字,小数位数为0
stuSeat smallint identity(1,1), --座位号,自动编号(标识列),从1开始递增,标识种子为1
stuAddress text --住址,允许为空
)

--是你的注释没写好啦。注释一下就行了:

if exists(select * from sysobjects where name='stuinfo')
drop table stuinfo
go
/*
create table 学员资料
(
字段1 数据类型 列的特征, /*列的特征包括该列是否为空(NULL)、是否是标识列、是否有默认值、是否为主键*/
字段2 数据类型 列的特征, /*列的特征包括该列是否为空(NULL)、是否是标识列、是否有默认值、是否为主键*/
)
*/
create table stuinfo
(
stuName varchar(20) not null, --学员姓名,非空
stuNo char(6) not null, --学号,非空
stuAge int not null, --年龄,Int类型不用指定大小
stuID numeric(18,0), --身份证号,Numeric(18,0)代表18位数字,小数位数为0
stuSeat smallint identity(1,1), --座位号,自动编号(标识列),从1开始递增,标识种子为1
stuAddress text --住址,允许为空
)

把这段删了
create table 学员资料
(
字段1 数据类型 列的特征, /*列的特征包括该列是否为空(NULL)、是否是标识列、是否有默认值、是否为主键*/
字段2 数据类型 列的特征, /*列的特征包括该列是否为空(NULL)、是否是标识列、是否有默认值、是否为主键*/
)

把所有stuDB改成stuinfo

create table 学员资料
(
字段1 数据类型 列的特征, /*列的特征包括该列是否为空(NULL)、是否是标识列、是否有默认值、是否为主键*/
字段2 数据类型 列的特征, /*列的特征包括该列是否为空(NULL)、是否是标识列