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

一个简单的sql问题,有办法给一个表添加ID 列
我想随便一个表,我想给这个表加一个ID列,但不用identity()函数去into   到另一个表,能够直接在本表添加。
请高手们指点

------解决方案--------------------
create table test(col int)
insert test select 1
union all select 2

alter table test add id int identity(1,1)

select * from test

------解决方案--------------------
alter table test add id int identity(1,1)
------解决方案--------------------
alter table test add id int identity(1,1)