Reputation: 5299
I tried to set null to columns like following.
ALTER TABLE myschema.table ALTER COLUMN (test_id,type) SET NOT NULL;
But it returned syntax error like Syntax error at or near Line 3, Position 47
Are there any proper way to achieve this ?
If someone has opinion please let me know.
Thanks
Upvotes: 12
Views: 7904
Reputation: 71
Try doing it separately for both the columns:
ALTER TABLE myschema.table ALTER COLUMN test_id SET NOT NULL;
ALTER TABLE myschema.table ALTER COLUMN type SET NOT NULL;
Upvotes: 7
Reputation:
You can't provide a list of column in parentheses, you need to use multiple ALTER COLUMN options separated by a comma:
ALTER TABLE the_table
ALTER COLUMN test_id set not null,
ALTER COLUMN type SET NOT NULL;
Upvotes: 16