Partilhar via


Autonumbering and Identifier Columns

For each table, a single identifier column can be created that contains system-generated sequential values that uniquely identify each row within the table. For example, an identifier column can generate unique customer receipt numbers for an application automatically as rows are inserted into the table. Identifier columns generally contain values unique within the table on which they are defined. This means that other tables that contain identifier columns can contain the same identity values used by another table. However, this is ordinarily not a problem because the identifier values are typically used only within the context of a single table, and the identifier columns do not relate to other identifier columns in other tables.

A single, globally unique, identifier column can be created per table that contains values unique across all networked computers in the world. A column guaranteed to contain globally unique values is frequently useful when similar data from multiple database systems must be merged; for example, in a customer billing system with data located in various company subsidiaries around the world. When the data is merged into the central site for consolidation and reporting, using globally unique values prevents customers in different countries/regions from having the same billing number or customer ID.

SQL Server 2005 uses GUID columns for merge replication and transactional replication with updating subscriptions to make sure that rows are uniquely identified across multiple copies of the table.

See Also

Concepts

Creating and Modifying Identifier Columns
Using uniqueidentifier Data

Other Resources

Merge Replication Overview
NEWID (Transact-SQL)
uniqueidentifier (Transact-SQL)
Updatable Subscriptions for Transactional Replication

Help and Information

Getting SQL Server 2005 Assistance