Error setting newsequentialid() default in sql server 2008

sql-server-2008

Solution

Quoting accepted answer of this question.

Workaround: create your table without specifying any default, and then type in this T-SQL statement in a normal query window and run it:

ALTER TABLE dbo.YourTable
    ADD CONSTRAINT DF_SerialID DEFAULT newsequentialid() FOR SerialID

Problem

I have a uniqueidentifier column in a table and it's not a key or index. I want to set the default value using NEWSEQUENTIALID(), but I get the error: Error validating default for column.. But if I use NEWID() no error. What's going on? EDIT: you can just ignore the error dialog and continue.

Original source

Related problems