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 |