加盟童鞋店有哪些品牌:sql查询分析器在建表过程中怎样使用一个列名具有自动增量的属性,语句是什么?

来源:百度文库 编辑:高考问答 时间:2024/05/10 13:59:29
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
)