Tuesday, June 28, 2011

Remove The NOT NULL Column Constraint ALTER TABLE


Many times it may be necessary to remove the limitation Not Null applied to a column in a table. It is generally necessary to overcome the unexpected integrity constraints (which rarely happens, if well designed) against a table. We can remove the constaint Not Null using the ALTER TABLE .... ALTER COLUMN ... option.

A sample query is

Alter table dbo.Test

alter column test nvarchar (10) null;

You can also reuse the next.

Alter table dbo.Test

alter column test nvarchar (10) NOT NULL;

No comments:

Post a Comment