Ne bych použijte to k doplnění "chybějících" ID, ale mělo by to fungovat:
Insert Into t (id)
Select Coalesce( Min(t.id) + 1, 0 )
From t
Left Join t As t2 On ( t2.id = t.id + 1 )
Where t2.id Is Null
Získejte všechna id s kde id + 1 neexistuje (Left Join ) a vložte Min(id)+1 nebo 0 pokud není k dispozici.