Sequential Guid

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Is there an equivalent class function in .NET to generate sequencial guid
just like the NewSequentialID() function in SQL Server 2005?
 
Hello Roy,

Guid g = Guid.NewGuid();

R> Is there an equivalent class function in .NET to generate sequencial
R> guid just like the NewSequentialID() function in SQL Server 2005?
R>
---
WBR,
Michael Nemtsev :: blog: http://spaces.live.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsch
 
Hello Roy,

Ahh, missed it.
Guid can't be generated sequential
only random

R> Is Guid.NewGuid() going to generate sequencial guid? I think it is
R> random guid.
R>
R> "Michael Nemtsev" wrote:
R>---
WBR,
Michael Nemtsev :: blog: http://spaces.live.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsch
 
Here is the comb algorithm (have not tested this implementation, just found
on web):


--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
http://gregorybeamer.spaces.live.com

*************************************************
Think outside of the box!
*************************************************
 
Accidental enter key press:

Here is comb
public static Guid NewComb()
{
byte[] dateBytes = BitConverter.GetBytes(DateTime.Now.Ticks);
byte[] guidBytes = Guid.NewGuid().ToByteArray();
// copy the last six bytes from the date to the last six bytes of the GUID
Array.Copy(dateBytes, dateBytes.Length - 7, guidBytes, guidBytes.Length - 7,
6);
return new Guid(guidBytes);
}

Look up COMB GUID on google if you need more.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
http://gregorybeamer.spaces.live.com

*************************************************
Think outside of the box!
*************************************************
 
Back
Top