TechnoLearnAcademy

TECHNOLEARN

SQL ALTER ADD NOT NULL

The ALTER TABLE Statement is used to add not null constraint to an existing table.

Syntax:      

                  ALTER TABLE  table_name                                                                                                                                                                ALTER COLUMN columnname datatype NOT NULL

Example:

   Objective: In this example, we will add not null constraint to an existing table emp
                   ALTER TABLE Tbl_Emp
                   ALTER COLUMN Location varchar(20) NOT NULL
Scroll to Top