What is the purpose of the Uniqueidentifier data type?
Accordingly, what is Uniqueidentifier datatype in SQL Server?
GUID is a 16 byte binary SQL Server data type that is globally unique across tables, databases, and servers. Local primary keys are used to uniquely identify records within a table. On the other hand, GUIDs can be used to uniquely identify records across tables, databases, and servers.
In this way, what are GUIDs used for?
GUIDs are used in software development as database keys, component identifiers, or just about anywhere else a truly unique identifier is required. GUIDs are also used to identify all interfaces and objects in COM programming. A GUID is a "Globally Unique ID". Also called a UUID (Universally Unique ID).
guid-sql-server.sql -- If you want to generate a new Guid (uniqueidentifier) in SQL server the you can simply use the NEWID() function. -- This will return a new random uniqueidentifier e.g. You can directly use this with INSERT statement to insert new row in table. -- Inserting data in Employees table.