Categories
Sql Server

How to create NOT NULL constraints In Sql server

Constraints are used to limit the type of data that can go into a table.

SQL NOT NULL Constraint:- The NOT NULL constraint enforces a column to NOT accept NULL values.

Query:-

CREATE TABLE Account
(
P_Id int NOT NULL,
LastName varchar(50) NOT NULL,
FirstName varchar(50)
)

In this query Id and Lastname is NOT NULL that stand for that they not accept null values.