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: 393 | Points: 40
Answer:

Following are the differences:-

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

2).
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.

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

4).
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