This question was posed in this month's SQL Server mag and applies to some work I need to do, But the author of the article couldnt figure it out...
If you have a table with an integer column..for example
CREATE TABLE #Soap (nID int)
INSERT INTO #SOAP VALUES(1)
INSERT INTO #SOAP VALUES(2)
INSERT INTO #SOAP VALUES(10)
INSERT INTO #SOAP VALUES(50)
I want to find all the values that are not represented in the column, and are between the min and max values.
for example, the results here would be
3
4
5
6
7
8
9
11
.
.
.
49
I want to do this without a temp table.
Any good way of doing this??
If you have a table with an integer column..for example
CREATE TABLE #Soap (nID int)
INSERT INTO #SOAP VALUES(1)
INSERT INTO #SOAP VALUES(2)
INSERT INTO #SOAP VALUES(10)
INSERT INTO #SOAP VALUES(50)
I want to find all the values that are not represented in the column, and are between the min and max values.
for example, the results here would be
3
4
5
6
7
8
9
11
.
.
.
49
I want to do this without a temp table.
Any good way of doing this??