iD自动序号是什么属性

来源:百度知道 编辑:UC知道 时间:2024/06/18 13:51:23
我创建一个MSSQL数据库表,我再建表的时候ID想自动序号排列 应该选择用何属性啊?

int

没用过mssql,但使用过sql server2000,里面要设置ID自增用identity(1,1)表示从1开始递增1。在oracle里面不支持这个,用序列可以实现递增。
create sequence new_sequence
start with 1
increment by 1
nocycle

向表插入数据的时候:
insert into table table_name(filed) values(new_sequence.nextval)

具体怎么符合你的要求 ,自己看看吧

MSSQL数据库啊,呵
就是整型int,让它自动增长即可,给你个例子
create table article (
id int primary key auto_increment,
title varchar(255),
);

查询分析器
create table

ID int identity(1,1),
....
)
企业管理器
选择字段
【标识】 改为 【是】
【标识种子】 1
【标识递增量】 1

同意 hinco
【标识】 改为 是 //就改成自动排号了
【标识种子】 1 //开始数字
【标识递增量】 1 //递增值