encyclopegia.org

Identity column

An identity column is a column (also known as a field) in a database table that is made up of values generated by the database.[src] This is much like an AutoNumber field in Microsoft Access or a sequence in Oracle.[src] Because the concept is so important in database science, many RDBMS systems implement some type of generated key, although each has its own terminology.[src] Today a popular technique for generating identity is to generate a random UUID.[src] An identity column differs from a primary key in that its values are managed by the server and usually cannot be modified.[src] In many cases an identity column is used as a primary key; however, this is not always the case.[src] It is a common misconception that an identity column will enforce uniqueness; however, this is not the case.[src] If you want to enforce uniqueness on the column you must include the appropriate constraint too.[src] In Microsoft SQL Server you have options for both the seed (starting value) and the increment.[src] By default the seed and increment are both 1.[src]

An identity column is a column (also known as a field) in a database table that is made up of values generated by the database.[src] This is much like an AutoNumber field in Microsoft Access or a sequence in Oracle.[src] Because the concept is so important in database science, many RDBMS systems implement some type of generated key, although each has its own terminology.[src] Today a popular technique for generating identity is to generate a random UUID.[src] An identity column differs from a primary key in that its values are managed by the server and usually cannot be modified.[src] In many cases an identity column is used as a primary key; however, this is not always the case.[src] It is a common misconception that an identity column will enforce uniqueness; however, this is not the case.[src] If you want to enforce uniqueness on the column you must include the appropriate constraint too.[src] In Microsoft SQL Server you have options for both the seed (starting value) and the increment.[src] By default the seed and increment are both 1.[src] ==Code samples== Create Table Contacts ( FirstName varChar(30), LastName varChar(30), Phone varChar(16), ContactID int identity(1, 1) ) or Create Table Contacts ( FirstName varChar(30), LastName varChar(30), Phone varChar(16) ) GO Alter Table Contacts Add ContactID int identity(1, 1) In PostgreSQL CREATE TABLE contact ( contact_id bigint GENERATED ALWAYS AS IDENTITY, first_name varchar, last_name varchar, phone varchar ); ==Related functions== It is often useful or necessary to know what identity value was generated by an INSERT command.[src] Microsoft SQL Server provides several functions to do this: @@IDENTITY provides the last value generated on the current connection in the current scope, while IDENT_CURRENT(tablename) provides the last value generated, regardless of the connection or scope it was created on.[src] Example: Insert Into Contacts ( FirstName, LastName ) Values ( 'Test', 'User' ) -- Select @@Identity -- OR -- Declare @ID int Select @ID = @@Identity Update Contacts Set Phone = 'XXX-YYY-ZZZZ' Where ContactID = @ID ==See also== Surrogate key Unique key ==External links== MSDN Article "Managing Identity"[src]

23 sentences · 23 cited inline · 0 references stored

References

No reference rows published for this article.

Cite this article

MLA

"Identity column." encyclopegia.org, 2024, https://encyclopegia.org/wiki/identity-column. Accessed 01 December 2026.

Chicago

"Identity column." encyclopegia.org. Accessed December 1, 2026. https://encyclopegia.org/wiki/identity-column.

APA

encyclopegia.org. (2024). Identity column. Retrieved December 1, 2026, from https://encyclopegia.org/wiki/identity-column

Accessed December 1, 2026 · CC BY-SA 4.0 · citation page · JSON

CC BY-SA 4.0 · share-alike · https://en.wikipedia.org/w/index.php?oldid=1244302079 · 0.5 · snapshot enwiki-001244302079

Cite · JSON · Search

Related services and records

Services

  • Estate — measured countries, lanes and facts
  • Intel — live corroborated events
  • Legal — statutes, cases and citations
  • Encyclopedia — articles with inline sources
  • Space — launches, satellites and orbits
  • Search — federated search and reports
  • Pass — passport account and SSO
  • Corpora — read-only corpus origins
  • e01 — self-hosted corpora and tools
  • Careers — open roles: frontier engineers and sales partners
  • Index — every corpus, paper and record
  • Estate guide — what a public data estate is
  • Founder — Lois-Kleinner Alpasan
  • Records — DOIs and external deposits
  • Documents — one-pagers, PDFs and QR codes
  • Brand kit — logos and share images
  • Papers — plain-language briefs with citations
  • Browser — search engine, PWA and bookmarklet
  • Anticloud — the operator and its projects

As seen in Business Insider · 336 outlets · evidence DOIs · plain-language papers

Text and metadata only; each target carries its own sources. Missing data is published as no-data, never estimated.