Showing posts with label generation. Show all posts
Showing posts with label generation. Show all posts

Wednesday, March 7, 2012

NEWID() Generation Code

hi,
i want the code for newid() in sqlserver 2000 , if anyone knows about it please send me the code.I need it for my customised application . It will be of great help.
Could you explain what exactly you're trying to achieve? I can guarantee you no one will send you the code.|||If your customized application is managed code, Guid.NewGuid() generates a new GUID.

If your app is native, HRESULT CoCreateGUID(GUID *pguid) does the same thing.

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