Difference Between NEWSEQUENTIALID() and NEWID() - SQL Server

 both generates the GUID of datatype of uniqueidentifier NEWID() generates the GUID in random order whereas NEWSEQUENTIALID() generates the GUID in sequential order


Example:-

----Create Test Table for with default columns values
CREATE TABLE temptable
(Column1 uniqueidentifier DEFAULT NEWID(),
Column2 uniqueidentifier DEFAULT NewSequentialID())


----Inserting five default values in table
INSERT INTO  temptable DEFAULT
VALUES
INSERT INTO 
temptable DEFAULT

VALUES
INSERT INTO 
temptable DEFAULT

VALUES
INSERT INTO 
temptable DEFAULT
VALUES
INSERT INTO 
temptable 
DEFAULT
VALUES




SELECT FROM 
temptable

Comments

Popular posts from this blog

GROUP BY, CUBE, ROLLUP and SQL SERVER 2005

How to get content of Ckeditor & Fckeditor using Javascript

How to Fix Error- Sys.WebForms.PageRequestManagerTimeoutException - The server request timed out