Guids as Keys

March 21, 2007
No Comments.


I was reading this entry today and thought someone else was advocating Guids as keys when I saw mention of something I hadn’t seen before:

NEWSEQUENTIALID() Function in SQL Server 2005

This function (which is only valid in a columns’s DEFAULT constraint) will make GUIDs that are somewhat sequential which eliminates the biggest complaint of mine (fragmented PK Indexes).  It is SQL Server 2005 only, but its a cool feature.  To be clear this is how its used:

            (EmployeeID uniqueidentifier DEFAULT NEWSEQUENTIALID())