One simple way to do this. There are literally hundreds of ways to accomplish this. The easiest way is to have a tally table.DECLARE @Sample TABLE ( Number INT PRIMARY KEY )INSERT @Sample ( Number )VALUES (1), (2), (3), (4), (6);WITH cteSource(Number)AS ( SELECT Number - 1 FROM @Sample UNION SELECT Number FROM @Sample UNION SELECT Number + 1 FROM @Sample)SELECT c.NumberFROM cteSource AS cLEFT JOIN @Sample AS s ON s.Number = c.NumberINNER JOIN ( SELECT MIN(Number) AS a, MAX(Number) AS b FROM @Sample ) AS x ON c.Number BETWEEN x.a AND x.bWHERE s.Number IS NULL
N 56°04'39.26"E 12°55'05.63"