1.:newsequentialid 函数比起 newid 函数最大的好处是:如果你在一个 UNIQUEIDENTIFIER 字段上建立索引,使用 newid 产生的新的值是不固定的,所以新的值导致索引B+树的变化是随机的。而 newsequentialid 产生的新的值是有规律的,则索引B+树的变化是有规律的。有规律和无规律就会带来性能的改进。
2. 如何设定DEFAULT VALUE为NEWSEQUENTIALID() 通过UI的方式设定默认值时,由于SQL SERVER 2005的BUG(即使是SP2也没有解决),导致我们设置了默认值为NEWSEQUENTIALID()保存时会出现以下错误: Warning were encountered during the pre-save validation process, and might result in a failure during save. Do you want to continue attempting to save? 'Table1' Table -Error validating the default for column 'Id' 有两种方式可以解决:要么直接点Yes,要么通过CREATE TABLE语句来建表。