Tell us about difference between NEWSEQUENTIALID() and NEWID() Sql Server function?

 Posted by vishalneeraj-24503 on 10/7/2014 | Category: Sql Server Interview questions | Views: 1076 | Points: 40

Following are the differences:-

NEWSEQUENTIALID() generates the unique identifier values sequentially.
Whereas NEWID() generates the unique identifier values randomly.

NEWSEQUENTIALID() function creates the GUIDs greater than the previously generated GUIDs,since the last restart of the system,because after restarting the system the next NEWSEQUENTIALID can be started from the lower range.

Both NEWID() and NEWSEQUENTIALID() are globally unique. Starting of NEWSEQUENTIALID after the restart of the computer does not affect its globally uniqueness.

NEWSEQUENTIALID() uses the default constraint,and it can't be used in SELECT or SET queries like NEWID().

Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response