你是SQLServer嗎?如果是Oracle就沒有identity這個關鍵字.
是SQLServer可以這麼寫:
create table stdinfo
(
st_id int
IDENTITY (0,1) ,
st_name char(20) default ('NONAME'),
constraint PK_stdinfo PRIMARY KEY(st_id)
);或是:
create table stdinfo
(
st_id int
IDENTITY (0,1) PRIMARY KEY,
st_name char(20) default ('NONAME')
);
是SQLServer可以這麼寫:
create table stdinfo
(
st_id int
IDENTITY (0,1) ,
st_name char(20) default ('NONAME'),
constraint PK_stdinfo PRIMARY KEY(st_id)
);或是:
create table stdinfo
(
st_id int
IDENTITY (0,1) PRIMARY KEY,
st_name char(20) default ('NONAME')
);
解决方案 »
- 查看存储过程中都使用了哪些表,调用了哪些存储过程。
- ◆为何触发器出错还提交数据◆
- 一条SQL语句的疑问
- 新手,概念性问题,关于列标识和主键之间
- 一个简单的问题
- 请问 create/drop table 是否记录日志
- 求教MySQL的具体安装步骤,谢谢~
- 如何通过SQL语句,得到一个表的某个字段的类型和长度?
- 我在看别人开发的一些单机版小型数据库程序时,没有发现数据库引擎,而且它的数据库文件扩展名是.dat等陌生的文件,这种数据库格式是不是
- 如何获得某个时间与当下时间的天数?
- 求救:nvarchar(或varchar)字段的值中含有n个换行,如何在取一批记录(多个字段)时将换行去掉并返回?真的急!急急!急急!急!(tcyun)
- 如何使窗体变为模态或非模态?有分可以拿呦!!!
create table stdinfo
(
st_id int,
st_name char(20) default ('NONAME'),
constraint PK_stdinfo PRIMARY KEY(st_id)
);CREATE SEQUENCE stdinfoseq INCREMENT BY 1; 然後在插入數據時這樣:
insert into stdinfo values(stdinfoseq.nextval,'ColdWolf');就OK了.