注册 登录
编程论坛 SQL Server论坛

系列号

zdloveday 发布于 2008-10-13 15:37, 898 次点击
select [Id],[name] from xsm_news

我想问 一下 通过 sql 语句 可以实现 id 前面 在多排 系列号  吗?

这样 不管 我怎么删除 前面 永远 都是 1  2  3  4   5  ...

而 不会 出现 我删除 id=3 的就会 是 1 2  4  5  ....
1 回复
#2
hxwantres2008-10-13 16:23
creat table test
(id int primary key identity(1,1),
....
....)
这样你的ID就是系统自动增长,比如ID=1,2,3,4,5.。。
你删了ID=3的记录,系统自动排序ID还是1,2,3,4.。。。
1