Returns a random uniqueidentifier. The values are not sequential, so indexes on them become fragmented; it also can't be called from within a user-defined function.
Read more: Microsoft Learn
In the Ultra Transcenders books
Each book explains NEWID in context, with comparison tables and the common traps.
Terms in this definition
- uniqueidentifier
A data type holding a 16-byte GUID. Values from
NEWID()are random and cause fragmentation in a clustered index, whileNEWSEQUENTIALID()produces values that keep increasing. - VALUES
Returns in DAX the distinct column values, or table rows, still visible after filters are applied, sometimes with an extra blank entry. CALCULATE often takes the result as a table filter.
- UDF
Custom logic written in JavaScript and registered with a Cosmos DB container, callable only from queries. Calling one raises the request unit charge.
Related terms
- GETDATE
A T-SQL function giving the database system's current date and time as datetime, with GETUTCDATE returning the UTC equivalent. NEWID isn't allowed inside a user-defined function, but GETDATE is.