Sybase ASE
11.x 12.0 12.5 12.5.1 15.x
Last updated: 21 January 2006
Identity gaps revisited:
the long-awaited solution has arrived
This article "Identity gaps revisited" (first published in the 2nd Quarter Issue 2004 of the ISUG Technical Journal) describes how new features in ASE versions and 12.5.1 address the classic problems with repairing identity gaps.
In addition, the article describes an undocumented trick which lets you avoid identity gaps even when a shutdown with nowait is performed; this trick works as far back as ASE 11.0.
The article "Identity gaps revisited" can be downloaded here (PDF format).

The stored procedures described in this article (sp_identity_remove, sp_identity_restore, sp_idgap_repair and the modified version of sp_chgattribute) can be downloaded here ( Updated Jan-2006: added 15.0 version of sp_chgattribute).
Of these procedures, sp_idgap_repair is especially interesting as it is a one-stop solution to fix identity gaps.

Additional information about identity gaps can be found here.

 This document is located at