交通安全内容资料大全:sql查询分析器在建表过程中怎样使用一个列名具有自动增量的属性,语句是什么?

来源:百度文库 编辑:高校问答 时间:2024/10/01 13:02:10
sql查询分析器在建表过程中怎样使用一个列名具有自动增量的属性,语句是什么?
比如:
create table mytab
(id int notnull,
name varchar(10) nutnull)
go
我想让列ID为自动增量,要添什么语句。

创建一个identity 列 即可

create table mytab
(id int identity(1,1) not null,
name varchar(10) not null
)