一张数据表 没有主键 数据7000条 我想add一个 字段 请问 如何让这个字段 自动的生成 号码呢
---------------------------------------------------------------
select 编号 int identity(1,1),* into #temp from 表
drop table 表
select * into 表 from #temp
---------------------------------------------------------------
ALTER TABLE 表名 add 字段名 [int] IDENTITY (1, 1) NOT NULL
---------------------------------------------------------------
alter table yourtable add id int identity(1,1) primary key