sql2000主键自增

发布时间:2024-05-19 16:07 发布:上海旅游网

问题描述:

我在数据库中有个friend表。里边有个表项是主键,现在需要往数据库插入数据,但是主键总不能每次自己输入吧?所以想问一下,怎么设置主键自增?

问题解答:

代码:
create table sys_right_cat
(
right_cat_id int primary key identity(1,1),
right_cat_name varchar(20) not null,
right_cat_des text
)
identity就是自增从1开始每次增加1
非代码:
选中一列,找到下面列属性的标识规范,把是标识改为是

create table friend
(id int identity(1,1) primary key

热点新闻