日期:2014-05-18  浏览次数:20327 次

在已经存在的表添加一个ID,自增号。
ACCESS里面都有这个功能。自增ID
从1,开始,每新建一条记录就增加一个ID,请问怎么建立呢?

------解决方案--------------------
alter table 你的表的名字 add 字段名字 int identity
------解决方案--------------------
create table tb
(
id int identity(1,1)
)
------解决方案--------------------
探讨

create table tb
(
id int identity(1,1)
)

------解决方案--------------------
楼主描述的是针对一个已经存在的表(字段),如何去加这个identity
------解决方案--------------------
declare @tab table(int id identity(1,1))
------解决方案--------------------
alter table 表 add 字段名字 int identity
------解决方案--------------------
SQL code
alter table tb add id bingint identity(1,1)

------解决方案--------------------
SQL code

create table tb
(id int identity(1,1) )