Making NOT NULL as the default when creating columns

Database
Enthusiast

Making NOT NULL as the default when creating columns

When I create a table like below create multiset table test_test ( a12 int ,a13 char(4) ,b34 varchar(100) ); the columns will accept null values. I want to know if there are any session settings or any other settings or options where by if I use the above statement the columns will NOT accept null values. i.e. I always want columns to be created with NOT NULL attribute even if I don't specify it. I understand I will face troubles if I don't assign a default value in some cases. But that is the idea. Basically I want to keep a habit of creating columns with NOT NULL and default values, but also have some indication from DB side if I don't do so. And this indication should come as soon as possible.
2 REPLIES
Junior Contributor

Re: Making NOT NULL as the default when creating columns

No, there's no setting.

You must add NOT NULL to each column.

Enthusiast

Re: Making NOT NULL as the default when creating columns

Thank You