The query could be simplified if you're only interested in skipped series between min and max values in the table
SELECT t1.Orno+1AS bg, t2.Orno-1AS en
FROM #mytable t1
FULL JOIN #mytable t2
ON t2.Orno > t1.Orno
WHERE (t2.Orno - t1.Orno) > 1ANDNOTEXISTS ( SELECT * FROM #mytable
WHERE Orno > t1.Orno AND Orno < t2.Orno)
> >Thanks for the reply. I Will try what you suggested and will keep you posted.