ALTER TABLE MyCustomers ALTER COLUMN CompanyName SET DEFAULT 'A. Datum Corporation'
Appoint checking the syntax, SQL Server 2005 gives me the following error:
Msg 156, Level 15, State 1, Line 1
Incorrect syntax near the keyword 'set'.
I was so frustrated and have no idea why would this happened (until now I have completely no idea so please tell me if you know). Turn out I have written the following instead and it's working like a charm!
|ALTER TABLE TableName WITH NOCHECK|
ADD CONSTRAINT DF_DefaultName DEFAULT 'Default Value' FOR ColumnName