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.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With