Select k.barcode+1 as missing From yourtable k; > Where k.barcode+1 Not in (Select barcode From yourtable)It will find the beginning of each hole, however it won't find the size of the hole. IOW, if 20 consecutive numbers are missing, it will find the first one. But then with a fox cursor, index and Set Near ON it shouldn't be a problem to find the next existing number and gauge the size of the hole.