Unique Identifier and New ID – SQL Server
Unique Identifier is an identifier that is considered to be a unique candidate among other identifiers in a list.
Uniqueidentifier is a 16 byte GUID (Global Unique Identifier) data type in SQL Server used to store GUID.
NEWID(): function is used to create a value of type uniqueidentifier. This value as 32 hexadecimal digits with groups separated by hyphens. The hexadecimal numbers are grouped as 8-4-4-4-12. You can also see that in the example given below.
We can create uniqueidentifier column in a table to store unique records. NEWID() function helps developer to create GUID easier and faster. So, we can consider using this data type in the table design.
There are other unique identifiers that are worth learning now.
- Organizationally Unique Identifier
- Universally Unique Identifier
- Identity correlation
- World Wide Port Name
- MAC address