MySQL is telling syntax error: unexpected 'DEFAULT' in my script below. How come is this?
USE `neoweb`;
ALTER TABLE `neoweb`.`ActivationRequests` ADD CONSTRAINT
`DF_ActivationRequests_CreatedDate` DEFAULT (utc_timestamp()) FOR `CreatedDate`;
MySQL is telling syntax error: unexpected 'DEFAULT' in my script below. How come is this?
USE `neoweb`;
ALTER TABLE `neoweb`.`ActivationRequests` ADD CONSTRAINT
`DF_ActivationRequests_CreatedDate` DEFAULT (utc_timestamp()) FOR `CreatedDate`;
Oh... DEFAULT
is not a constraint.
Anyway your syntax seems wrong.
ALTER TABLE TABLENAME
ADD CONSTRAINT [ PRIMARY KEY/ FOREIGN KEY/ UNIQUE/ CHECK ]
is the minimum syntax for adding constraint.
You seem to have default value on your column. How to set default value using ALTER
statement is answered here