Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2001-06-12 : 22:23:51
|
Bob writes "G'day, Guru(s)...
I've got a requirement somewhat similar to that which was answered on the 24th of August 1999 ("I have a table which has a unique, numeric ID field that isn't always sequential..."), but my dilemma is from the opposite direction...
Based on the reasoning that any numeric field (in this case an integer) will only be able to increment to a defined upper limit, I'd like to re-use the ID numbers of records which have previously been deleted.
I'm presently using "SELECT MaxID=MAX(ID) FROM Table" and adding one to the returned value, but what I'd like to do is have the query return the lowest available ID - if I've got 57 records and delete record 34, I'd like 34 to be returned as the "next available" ID.
I'm using MS SQL 7.0, running on Windows NT4 on the staging machine and Windows2000 on the production server, and I'd really appreciate your input on this.
- Bob Milutinovic." |
|
|
|
|
|