0

I am adding one Boolean Column(status) into table(EMPLOYEE) in DB2 with below script,

ALTER TABLE EMPLOYEE ADD status CHAR(1) not null DEFAULT '1' constraint EMPLOYEE_CK31 check (status in ('0','1'));  

It is giving me error. Please let me know what is wrong in this script ?

1
  • This script worked. ALTER TABLE EMPLOYEE ADD status CHAR(1) DEFAULT '1' not null constraint EMPLOYEE_CK31 check (status in ('0','1')); Commented Jan 12, 2017 at 5:38

1 Answer 1

1

This script worked after changing position of Default.

ALTER TABLE EMPLOYEE ADD status CHAR(1) DEFAULT '1' not null constraint EMPLOYEE_CK31 check (status in ('0','1'));
Sign up to request clarification or add additional context in comments.

1 Comment

@Esperento57 -- your comment may be correct for Postgres, but it is completely wrong for DB2 -- database in question.

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.