What is check constraint?

 Posted by Rajni.Shekhar on 4/17/2012 | Category: Sql Server Interview questions | Views: 1572 | Points: 40
Answer:

It is used to enforce domain integrity. Check constraints are used to limit the values of a column.

Example:
CREATE ABLE tblTest

(
ID INT NOT NULL,
NAME VARCHAR(20),
CITY VARCHAR(20),
CONSTRAINT chk_Test CHECK (ID>0 AND CITY='DEHI')
)


Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response