Find value not in between values.

Find value not in between values.

am 13.07.2006 16:43:46 von ron.vdm

Hi all.

I have a SQL question I am having trouble with. We have a table, with
a column that contains a code. These codes start at '00001', '00002',
'00003', '00004'... and so on. If the record containing '00003' as it's
code is deleted from the table, is there an SQL statement that can be
used to find the first missing record. I guess what we are looking for
is the lowest value of CODE not in the list of values between two
values, such as in the case '00001' to '99999'.

Thanks in Advance
Ron VanDerMaarel
VDM Management Systems Inc.

Re: Find value not in between values.

am 20.07.2006 00:45:21 von Jared

may need to create additional table that has 10000 number pre-loaded in good
sequence which can be use in join query to select where matching record is
null

wrote in message
news:1152801826.535860.25560@m79g2000cwm.googlegroups.com...
> Hi all.
>
> I have a SQL question I am having trouble with. We have a table, with
> a column that contains a code. These codes start at '00001', '00002',
> '00003', '00004'... and so on. If the record containing '00003' as it's
> code is deleted from the table, is there an SQL statement that can be
> used to find the first missing record. I guess what we are looking for
> is the lowest value of CODE not in the list of values between two
> values, such as in the case '00001' to '99999'.
>
> Thanks in Advance
> Ron VanDerMaarel
> VDM Management Systems Inc.
>