13

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

1

2 Answers 2

18

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;
Sign up to request clarification or add additional context in comments.

Comments

7

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;

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.