Check Constraint in SQL Server

Posted by Akiii under Sql Server category on | Points: 40 | Views : 1621
A check constraint (also known as table check constraint) is a condition that defines valid data when adding or updating an entry in a table of a relational database. A check constraint is applied to each row in the table.

Create Table TestTable
UserID integer NOT NULL CHECK(UserID > 5),
UserName varchar(50)

In the UserID column in the above, value should be greater than 5 otherwise it won't allow saving the table !

Thanks and Regards

Comments or Responses

Login to post response