Reputation: 10802
I have a simple SQL statement, which looks like so:
alter table my_table alter column my_field set data type numeric(12,4) not null default 0;
But I get an error message, that points to not
. What is wrong with that?
Upvotes: 0
Views: 53
Reputation: 521209
Use separate ALTER COLUMN
clauses for the type, null behavior, and default value:
ALTER TABLE my_table
ALTER COLUMN my_field TYPE numeric(12,4),
ALTER COLUMN my_field SET DEFAULT 0,
ALTER COLUMN my_field SET NOT NULL;
Upvotes: 2