sql 查找自动增长的表中已经删除的记录的id
create proc a
as
declare @i int,@c int
set @i=1
set @c=(select MAX(id) from Table_1)
while (@i<@c+1)
begin
select case when exists ( select id from Table_1 where id=@i) then '[[' else @i end
set @i=@i+1
end
exec a
代码改变世界,记录知识.