I always assumed that IDENTITY columns were forcibly unique.
The IDENTITY property is only a mechanism that keeps track of the last value that was handed out and determines the next one that will be handed out (based on the increment).
@Shek: A Primary Key constraint and the Identity property have no direct relation.
What an Identity is, see above.
A Primary Key constraint is a declared rule that enforces NOT NULL values and prevents duplicate keys. Every Primary Key constraint is enforced with an underlying unique index that the engine automatically creates. This index cannot be removed, but will be automatically removed if the Primary Key constraint is dropped.
Usually a Identity column is used to uniquely identify a row. When it is used like that, you should always declare a Primary Key or Unique constraint on this column.
Gert-Jan
No comments:
Post a Comment