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 2000 Forums
 SQL Server Development (2000)
 Identity reused

Author  Topic 

mariechristine
Starting Member

27 Posts

Posted - 2007-03-12 : 11:28:16
I have a table with id an identity column.
Can I forbid the identity column of taking the same values of deleted ones?

How can I resolve this issue?

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2007-03-12 : 11:34:27
As per my knowledge, identity values does not reuse deleted values (unless of course you force it with DBCC CHECKIDENT). What problem you are facing currently?

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

mariechristine
Starting Member

27 Posts

Posted - 2007-03-13 : 03:04:21
If I move the database into another server, also the identity wont be reused???
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2007-03-13 : 04:12:43
"If I move the database into another server, also the identity wont be reused???"

Correct.

If you think there is some means by which it could attempt to be reused then put a Unique constraint/index on it.

If the Identity column is [the only column in] your Primary key already then there won't be any duplicates - i.e. any attempt to insert a duplicate will fail.

Kristen
Go to Top of Page

mariechristine
Starting Member

27 Posts

Posted - 2007-03-13 : 04:41:24
I don't mean by identity reused to be duplicate. But if some identities are deleted, if I move to another database will the same deleted numbers be used again?
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2007-03-13 : 04:51:55
IDENTITY numbers which are deleted / not used are never reused - unless you manually reset the "next identity number to use"

An identity column, in a given table, has a "next number to use" - that will be transferred with your database to the new server.

Or am I misunderstanding your question?

Kristen
Go to Top of Page
   

- Advertisement -