NOT NULL Constraint In SQL

In this article I am going to explain about NOT NULL Constraint in SQL.
  • 2399


The NOT NULL constraint in SQL Server enforces a column "not" to accept NULL values.

In this constraint, the field  always has to contain a value. A new record cannot be inserted, or updated a record without adding a value to this field.

The following SQL here, enforces the "P_Id" column and the "LastName" column not to accept NULL values


Suppose we create table named "Persons" and the column names are: P_ID, LAST NAME, FIRST NAME,ADDRESS AND CITY. So here, the P_ID and the LASTNAME will have the NOT NULL values.


© 2020 DotNetHeaven. All rights reserved.