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

SQL 7 Identity detect missing record

Status
Not open for further replies.

Brit

Programmer
May 15, 2001
15
US
I have a table with an identity field (Sql Server 7). I want a script to scan the table and return the record before a gap in the sequence.

(I have a gap in the sequence when a transaction failed and the inserted record is removed.)

Is it possible to do without creating a cursor to loop through the data?

thanks for your help,

Brit
 
There are several posts about resolving gaps in data. Search for gaps and check out the responses. Some solutions use a separate table that contain the complete range to be tested against (1 through 100000000 integers), while other use a more dynamic approach. I believe all posts try to avoid a cursor. --Angel
-----------------------------------
SELECT * FROM users WHERE clue > 0
(0 row(s) affected)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top