NEWSEQUENTIALID() and NEWID() both generates the GUID of datatype of uniqueidentifier.
NEWSEQUENTIALID:
- NEWSEQUENTIALID() generates GUID in hexadecimal incremental interval. The hexadecimal number can be any placed in GUID
- Function NEWSEQUENTIALID() can not be used in SQL queries and it can be only used in DEFAULT clause of table. NEWSEQUENTIALID() are predictable
- NEWSEQUENTIALID() generates the GUID in sequential order.
NEWID:
- NEWID() generates the GUID in random order whereas
- in case of privacy or security use NEWID() instead of NEWSEQUENTIALID()
- NEWID() will work perfectly fine when used in queries.
Table Syntax :
CREATE TABLE tablename
(
NewIDColumnName uniqueidentifier DEFAULT NEWID(),
NewSeqColumnName uniqueidentifier DEFAULT NewSequentialID()
)
No comments:
Post a Comment