How to Change a Column to Allow NULL in SQL Server

See SQL Server: Tips and Tricks for similar articles.
Looking to improve your SQL Server skills? Check out Webucator’s SQL Server classes.

If you have a column in a SQL Server table that does not allow NULL values and you need to change it to allow NULLs, here is how you do it.

Let's say, you created a table like this:

CREATE TABLE Employees (
  EmployeeID int IDENTITY(1,1) PRIMARY KEY,
  FirstName NVARCHAR(25) NOT NULL,
  LastName NVARCHAR(25) NOT NULL
);

Then you hire Madonna and realize you need to make LastName nullable. Here's how you change it.

ALTER TABLE Employees ALTER COLUMN LastName NVARCHAR(25) NULL;

Related Articles

  1. How to Change a Column to Allow NULL in SQL Server (this article)
  2. How to Check Case-Sensitivity in SQL Server
  3. How to Install Northwind on SQL Server