Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

First free number in a column

Status
Not open for further replies.

smitan

Programmer
May 11, 2002
115
0
0
DK
I need to find the first free number in a series of records.

Example:
tblTabel.Number contains 2000 2001 .... 2010.
But number 2004 and 2007 are missing. How do I find this in an easy way.

I will make a loop in MsAccess, but that is not the most efficient, when it is about 50.000 records.

Somebody having a stored procedure for me?

Thanks very much.
Smitan
 
Construct a numbers table and use join against that table





“I sense many useless updates in you... Useless updates lead to defragmentation... Defragmentation leads to downtime...Downtime leads to suffering..Defragmentation is the path to the darkside.. DBCC INDEXDEFRAG and DBCC DBREINDEX are the force...May the force be with you" --
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top