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.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 AutoNumber field Issue

Author  Topic 

s2002
Starting Member

49 Posts

Posted - 2009-04-08 : 04:28:32
hi,
I use .net webApplication to insert data to DB. There is an ID field on the table which is autonumber . AutoNumber Field doe not provide sequential numbers in some cases , Suppose 7560 , 7580 .
Could I recover non-Existance Numbers for ID field, Suppose 7561,7562,....

sincerley,
Smith

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2009-04-08 : 04:30:07
Yes you can with SET IDENTITY_INSERT {ON | OFF}
But why should you bother?

Here is a blog post how to re-use gaps in identity sequences
http://weblogs.sqlteam.com/peterl/archive/2009/03/10/How-to-efficiently-reuse-gaps-in-identity-column.aspx


E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2009-04-08 : 05:04:33
Why does gap matter in identity column?

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2009-04-08 : 05:06:28
Unless the maximum value have been reached as describeb in the blog post above...



E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page
   

- Advertisement -