How to Remove a NOT NULL Constraint in SQL Server in SQL Server

To remove a NOT NULL constraint for a column in SQL Server, you use the ALTER TABLE .... ALTER COLUMN command and restate the column definition.

alter table products
alter column brand_id smallint; -- undeclared attributes as NOT NULL will go back to default settings which is null in this case

alter table products
alter column brand_id smallint null; -- define the NULL attribute over a column

Previous

Next

Ready for a modern SQL editor?