Have a table that is populated by Entity Framework 3.1.1 code. The table contains a clustered index / primary key on ID which is defined as of type GUID with no default value. Is there a way in SQL to look at the row data and tell if the GUID values are a traditional random GUID vs a sequential GUID?

有帮助吗?

解决方案

One easy way is to ORDER BY the UNIQUEIDENTIFIER and if they are sequential you'll see a pattern. EG

866381AE-0976-EB11-A396-5C80B6738BD2
876381AE-0976-EB11-A396-5C80B6738BD2
886381AE-0976-EB11-A396-5C80B6738BD2
896381AE-0976-EB11-A396-5C80B6738BD2
8A6381AE-0976-EB11-A396-5C80B6738BD2
8B6381AE-0976-EB11-A396-5C80B6738BD2
8C6381AE-0976-EB11-A396-5C80B6738BD2
8D6381AE-0976-EB11-A396-5C80B6738BD2
8E6381AE-0976-EB11-A396-5C80B6738BD2
8F6381AE-0976-EB11-A396-5C80B6738BD2
906381AE-0976-EB11-A396-5C80B6738BD2
916381AE-0976-EB11-A396-5C80B6738BD2
926381AE-0976-EB11-A396-5C80B6738BD2
936381AE-0976-EB11-A396-5C80B6738BD2
946381AE-0976-EB11-A396-5C80B6738BD2

But if the table doesn't have a DEFAULT of NEWSEQUENTIALID it's unlikely that they are sequential.

许可以下: CC-BY-SA归因
不隶属于 dba.stackexchange
scroll top