Thursday, 30 November 2006

SQL Server 2005 NewSequentialID

SQL Server 2005 provides a new function called NewSequentialID that's similar to NewID(), a function that originated in SQL Server 2000 and is supported in SQL Server 2005. Both functions return a value of data type uniqueidentifier.
In the past, many people used NewID() to assign primary keys to columns, and these columns were unique across servers. When SQL Server 2000 first came out, I too used NewID() to create primary keys. Alas, I soon determined (as did many others) that using the NewID() function this way can cause a variety of performance problems and that NewID() doesn't provide a unique value that increases in order, as the IDENTITY-based key does.You get some important performance benefits when a key value is always higher than the last assigned value; generally these benefits are related to how data is stored on the pages.
The NewSequentialId creates a globally unique identifier (GUID) that's always greater than any GUID previously generated by the NewSequentialId function on a specified computer. Let's look at the example in Listing 1, which shows how to use the two functions to assign GUIDs that are higher in sort order than the previously assigned vales. . . .

Refer to the link below for details