Two step process to convert NULL to NOT NULL. We will assume that we have a column with a data type of VARCHAR and we are trying to convert it to allow NOT NULL Values.
Step 1: Convert all values to NOT NULL
- UPDATE TableName
- SET ColumnName = ”
- WHERE ColumnName IS NULL
Step 2: Change Column NULL Values
- ALTER TABLE TableName
- ALTER COLUMN ColumnName VARCHAR(100) NOT NULL
Finally, we are done with Altering Column.
If you enjoyed this blog, please subscribe to be updated on future posts.