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)
 Reuse Numbers In Identity Column

Author  Topic 

Jonny1409
Posting Yak Master

133 Posts

Posted - 2008-03-04 : 09:04:16
Hello,

I have an ID column which is an Identity column, and it counts from 1 upwards.

If I have 10 records, I have ID's number 1 to 10.
If I then add another record, it will give the ID number 11.

Imagine I then delete ID number 9
Is it possible to get the next record I create to take number 9 instead of 12 ?

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-03-04 : 09:12:39
Nope. The value of id column will be populated as next auto incremented value.
Go to Top of Page

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2008-03-04 : 09:17:49
Not unless you manually change the seed value using DBCC CHECKIDENT.

Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-03-04 : 09:19:23
quote:
Originally posted by harsh_athalye

Not unless you manually change the seed value using DBCC CHECKIDENT.

Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"


But wont this restart the numbering again?
Go to Top of Page

Jonny1409
Posting Yak Master

133 Posts

Posted - 2008-03-04 : 09:21:28
Thanks everyone - I had a feeling this was the case.

I'll just leave it as it is.
Go to Top of Page

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2008-03-04 : 09:38:16
quote:
Originally posted by visakh16

quote:
Originally posted by harsh_athalye

Not unless you manually change the seed value using DBCC CHECKIDENT.

Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"


But wont this restart the numbering again?



Yes it will. But that's the only way to reuse old number again or using IDENTITY_INSERT setting.

Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page
   

- Advertisement -