Existing Null Values: If the column currently contains NULL values

Existing Null Values: If the column currently contains NULL values, you must either update those values to a non-null value or remove the NULL values before applying the NOT NULL constraint. SQL Server will not allow you to set a column to NOT NULL if there are existing NULL values in that column.

 

-- Update existing NULL values
UPDATE Employees
SET Email = '[email protected]'
WHERE Email IS NULL;

 

Up Next
    Ebook Download
    View all
    Learn
    View all