select identity(int,1,1) as id,pzid
into #temp
from pz
select * from #temp
drop #temp
在SQL语句后面加上select @@identity就可以了,这是针对插入新列用的,查询没必要
要 1,2,3,4 这种顺序的。
就直接 ROW_NUMBER 就可以了
例如:
select
ROW_NUMBER() OVER(ORDER BY (SELECT 1)) id,
pzid
from pz