declare @cou;
select @cou=count(*) from table;
delcare @max;
select @max=max(id) from table;
if @max>@cou
begin
while @max>0
begin
insert into table2 values(@i);
select @max=@max-1;
end
end
--漏号
select * from table2 where id not in(select id from table)