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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Missing numbers

Status
Not open for further replies.

Saama5

Programmer
Jan 6, 2002
52
US
I have an smallint field which can have maximum of 6000 value.
Everytime I insert record I want to insert the next available number but not the max(field1) + 1.

Because I might be deleting some records so there would be some unused numbers between 1 - 6000 which were not allocated yet.

Is there any single command or I have to use cursor and check out the next value with previous value.
 
You might check out faq183-840 which covers finding the gaps - or unused values - in a series of numbers. --Angel [rainbow]
-----------------------------------
Every time I lose my mind, I wonder
if it's really worth finding.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top