create table Sequence_Numbers (
id int not null primary key
);
insert into Sequence_Numbers(id) values
(1), (2), (3), (4), (6), (7), (8), (9),
(10), (15), (16), (17), (18), (19), (20);
select * from Sequence_Numbers
select l.id + 1 as start
from Sequence_Numbers as l
left outer join Sequence_Numbers as r on l.id + 1 = r.id
where r.id is null;
No comments: