To Display numbers other than existing ones in a range

greenspun.com : LUSENET : SQL Server Database Administration : One Thread

I have 3 values 0,3,6 in a table.These are the values of "index"(my field name) field in the table and the table contains only three records (with the field index values are above said 0,3,6).

My requirement is to get the numbers 1,2,4,5,7 (that is the numbers 0,3,6 removed from the range 0..7).

I can create maximum 8 records (0..7) and I need the possible index values for the creation. I will get the range value.But it is a single value from other table(that is , for eg: 8 only not 0..7)

eg: select index within the range 0..7 (ie which is 8) AND not in (select index from mytable)

Is it possible to show records more than in the table.ie. in the above case there is only 3 records. can I show it as 8 records ?

-- Anonymous, March 06, 2001

Answers

Thomas,

I don't see the problem. In your stored procedure or process go ahead and create a table that has the list of integer values (from 0 to 7) that you want work with.

Then just do a select like: select integer_value from integer_list where integer_value not in (select index_value from Toms_table)

Hope this helps,

Eric

-- Anonymous, March 08, 2001


Moderation questions? read the FAQ