I have a changelog that captures newly created users first and gives them a newid, then i want to approve that change and copy the newid generated for that user into the user table. Will I run into duplicate id's that way?The NEWID() function creates aGUID. This number should be, statistically-speaking, unique.
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
NewID
Hello,
I use VB.Net and SQL CE 2.0. I'd like to start using UniqueIdentifier fields as my primary keys.
I saw that this would return a NewID value
System.Guid.NewGuid().ToString()
however, it is not supported in Compact Framework. So how can one obtain the next NewId()?
Thank you.
NewGuid() is supported in .NET CF 2.0. You can also have a look at this article: http://msdn2.microsoft.com/en-us/library/aa446557.aspx - Generating GUIDs on the Pocket PC