You are here: Re: Getting list of recently added IDENTITY items « MsSQL Server « IT news, forums, messages
Re: Getting list of recently added IDENTITY items

Posted by Erland Sommarskog on 03/13/06 01:19

Doug (drmiller100@hotmail.com) writes:
> Finally, I don't know of any requirement that identity needs to be
> unique. In fact, I think it is pretty much written somewhere in the BOL
> they don't have to be, ESPECIALLY if a transaction is rolled back, or a
> row is deleted.

IDENTITY itself does not guarantee uniqueness. However, the only way
an the same IDENTITY value could be generated twice for the same table,
is if you play with the RESED option of DBCC CHECKIDENT.

In case of a rollback, the identity value that was used is "lost"; the
sequnce is not rolled back.

Usually, you have a PRIMARY KEY or UNIQUE constraint on IDENTITY columns,
so it's not much of an issue anyway.


--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация