[sql-server] How to remove not null constraint in sql server using query

I am trying to remove not null constraint in sql server 2008 without losing data.

This question is related to sql-server sql

The answer is


Remove column constraint: not null to null

ALTER TABLE test ALTER COLUMN column_01 DROP NOT NULL;


Remove constraint not null to null

ALTER TABLE 'test' CHANGE COLUMN 'testColumn' 'testColumn' datatype NULL;