Wednesday, December 27, 2006

Create Your Own Sequential GUIDs (like NewSequentialID() in SQL 2005)

Scott BellwareA Class that Creates Sequential GUIDs

"My current project uses GUID primary keys in a SQL Server 2005 database.  The primary keys are created in the middle tier.  I want to use the equivalent of SQL Server 2005's NEWSEQUENTIALID() function to create GUIDs that are friendly to clustered indexes.

The NEWSEQUENTIALID() function uses the UuidCreateSequential function from the rpcrt4.dll library in the Windows API.

Here's a class that generates sequential GUIDs much in the same way that SQL Server 2005 does: 

..."

That could handy. I might even be able to use this in my existing VB6 app suite (where we're using SQL2k and guid's generated in the middle tier)... hum...

No comments:

Post a Comment

NOTE: Anonymous Commenting has been turned off for a while... The comment spammers are just killing me...

ALL comments are moderated. I will review every comment before it will appear on the blog.

Your comment WILL NOT APPEAR UNTIL I approve it. This may take some hours...

I reserve, and will use, the right to not approve ANY comment for ANY reason. I will not usually, but if it's off topic, spam (or even close to spam-like), inflammatory, mean, etc, etc, well... then...

Please see my comment policy for more information if you are interested.

Thanks,
Greg

PS. I am proactively moderating comments. Your comment WILL NOT APPEAR UNTIL I approve it. This may take some hours...