Wednesday, March 7, 2012

NEWID()

Hi,

Can someone explain the generation method of a uniqueidentifier in the NEWID() function ?

This number is generated using identification number of computer network card and an unique number from the CPU clock. (The network card is unique too)|||

Why do you care?

The uniqueidentifier is guaranteed to be a unique hex identifier. It is not sequential and cannot be used for any other purpose than a unique id of an object or record.

|||

Check out the following topics for description on the Win32API that SQL Server uses for NEWID and NEWSEQUENTIALID. The actual algorithm details can be found on the web.

http://msdn2.microsoft.com/en-us/library/aa379205.aspx

http://msdn2.microsoft.com/en-us/library/aa379322.aspx

No comments:

Post a Comment