Otis wrote:
However, what's the downside of adding 1 line of code to add the GUID yourself? The routine used by Guid.NewGuid() in .NET and the GUID creation routines in sqlserver are the same
(though are ran on different machines perhaps). THe thing is that with a GUID in 2005, special code has to be added to generic code to pull back the value, so a special case routine has to be added for this, which is not that great, unless it's unavoidable.
Could you elaborate a bit why you need it in the db instead of adding the guid in .NET code?
Because Guid.NewGuid() in .NET will generate an "ordinary", not a sequential GUID. As we all know, using GUID as PKs can cause serious performance problems with larger tables. On the other hand, I must use GUIDs because of various replication/distributed arch. issues.
SQL Server 2005 addresses many of the current performance problems associated with using a "ordinary" GUID-based index by adding the newsequentialid() function. Newsequentialid() addresses some of the performance problems inherent in the current implementation of newid() by generating a GUID that will sort in an increasing order, making it more suitable for indexing.
newseqientialguid() is available ONLY in a DEFAULT constraint, you cannot use it in SPs and .NET languages for obvious reasons. To make things worse, pulling back the newly added GUID PK is only a part of the problem: since LLBLGen doesn't allow me to put a newid() and related DEFAULT values, I cannot use sequential GUIDs at all!