Last post Oct 16, 2018 02:01 AM by Zhi Lv - MSFT
Oct 15, 2018 11:08 AM|amithashenoy|LINK
Can we have table without primary key and using identity instead. ? what is the need of primary key?
Oct 15, 2018 11:35 AM|PatriceSc|LINK
Not really. "identity" is rarther similar to defining a default value for this column (that is automatically incremented for you). "primary key" is much more general. They are often used together but a pk is not always an identity column.
Most often an identity column is defined explicitely as a pk but you are not forced to do so if you ever come accross a situation whzere it is not the case...
Oct 15, 2018 11:47 AM|mgebhard|LINK
Identity is a property. A
primary key is a constraint.
A primary key can take advantage of the Identity type to create a non-null unique value but the two are not the same. Primary keys define how the records are persisted and searched they also enforce data integrity.
See the SQL docs for an in depth descriptions/definitions.
Oct 16, 2018 02:01 AM|Zhi Lv - MSFT|LINK
What is the difference between primary key and identity.
The difference between primary key and identity:
Can we have table without primary key and using identity instead. ?
what is the need of primary key?
More details about using primary key, please refer to this article: Primary and Foreign Key Constraints.